Example #1
0
 def test_success(self):
     lib.remove_target(self.cib.tree, "target1")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration", """
         <acls>
             <acl_role id="target2"/>
         </acls>
         """))
Example #2
0
def remove_target(lib_env, target_id):
    """
    Remove acl_target element with id target_id.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of taget which should be removed
    """
    with cib_acl_section(lib_env) as acl_section:
        acl.remove_target(acl_section, target_id)
Example #3
0
 def test_success(self):
     lib.remove_target(self.cib.tree, "target1")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration",
         """
         <acls>
             <acl_role id="target2"/>
         </acls>
         """
     ))
Example #4
0
def remove_target(lib_env, target_id):
    """
    Remove acl_target element with id target_id.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of taget which should be removed
    """
    with cib_acl_section(lib_env) as acl_section:
        acl.remove_target(acl_section, target_id)
Example #5
0
def remove_target(lib_env, target_id):
    """
    Remove acl_target element with id target_id.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of taget which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    acl.remove_target(cib, target_id)
    lib_env.push_cib(cib)
Example #6
0
File: acl.py Project: jmartign/pcs
def remove_target(lib_env, target_id):
    """
    Remove acl_target element with id target_id.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of taget which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    acl.remove_target(cib, target_id)
    lib_env.push_cib(cib)
Example #7
0
 def test_not_existing(self):
     assert_raise_library_error(
         lambda: lib.remove_target(self.acls, "target2"),
         (severities.ERROR, report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, {
             "id": "target2",
             "expected_types": ["acl_target"],
             "current_type": "acl_role",
         }))
Example #8
0
 def test_not_existing(self):
     assert_raise_library_error(
         lambda: lib.remove_target(self.cib.tree, "target2"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {"id": "target2"}
         )
     )
Example #9
0
 def test_not_existing(self):
     assert_raise_library_error(
         lambda: lib.remove_target(self.acls, "target2"),
         (
             severities.ERROR,
             report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE,
             {
                 "id": "target2",
                 "expected_types": ["acl_target"],
                 "current_type": "acl_role",
             }
         )
     )