示例#1
0
文件: common.py 项目: wuyeliang/pcs
def _validate_move_ban_clear_analyzer(resource_element):
    resource_is_bundle = False
    resource_is_clone = False
    resource_is_in_clone = False
    resource_is_promotable_clone = False
    resource_is_in_promotable_clone = False
    promotable_clone_element = None

    if is_bundle(resource_element):
        resource_is_bundle = True
    elif is_any_clone(resource_element):
        resource_is_clone = True
        if is_master(resource_element) or is_promotable_clone(resource_element):
            resource_is_promotable_clone = True
            promotable_clone_element = resource_element
    elif get_parent_any_clone(resource_element) is not None:
        parent_clone = get_parent_any_clone(resource_element)
        resource_is_in_clone = True
        if is_master(parent_clone) or is_promotable_clone(parent_clone):
            resource_is_in_promotable_clone = True
            promotable_clone_element = parent_clone
    return _MoveBanClearAnalysis(
        resource_is_bundle,
        resource_is_clone,
        resource_is_in_clone,
        resource_is_promotable_clone,
        resource_is_in_promotable_clone,
        (
            promotable_clone_element.get("id")
            if promotable_clone_element is not None
            else None
        )
    )
示例#2
0
 def my_assert(self, id_in, id_out):
     element_in = self.cib.find(f'.//*[@id="{id_in}"]')
     actual_out = clone.get_parent_any_clone(element_in)
     if id_out is None:
         self.assertIsNone(actual_out)
         return
     if actual_out is None:
         self.assertIsNone(id_out)
         return
     self.assertEqual(id_out, actual_out.get("id"))
示例#3
0
 def my_assert(self, id_in, id_out):
     element_in = self.cib.find(f'.//*[@id="{id_in}"]')
     actual_out = clone.get_parent_any_clone(element_in)
     if id_out is None:
         self.assertIsNone(actual_out)
         return
     if actual_out is None:
         self.assertIsNone(id_out)
         return
     self.assertEqual(id_out, actual_out.get("id"))