예제 #1
0
파일: test_acl.py 프로젝트: thulyacloud/pcs
 def test_target_id_is_not_unique_id(self):
     lib.create_target(self.acls, "target3")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration", """
         <acls>
             <acl_role id="target3"/>
             <acl_target id="target2"/>
             <acl_target id="target3"/>
         </acls>
         """))
예제 #2
0
파일: test_acl.py 프로젝트: thulyacloud/pcs
 def test_success(self):
     lib.create_target(self.acls, "target1")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration", """
         <acls>
             <acl_role id="target3"/>
             <acl_target id="target2"/>
             <acl_target id="target1"/>
         </acls>
         """))
예제 #3
0
 def test_target_id_is_not_unique_id(self):
     lib.create_target(self.cib.tree, "target3")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration",
         """
         <acls>
             <acl_role id="target3"/>
             <acl_target id="target2"/>
             <acl_target id="target3"/>
         </acls>
         """
     ))
예제 #4
0
파일: test_acl.py 프로젝트: tomjelinek/pcs
 def test_success(self):
     lib.create_target(self.acls, "target1")
     self.assert_cib_equal(self.create_cib().append_to_first_tag_name(
         "configuration",
         """
         <acls>
             <acl_role id="target3"/>
             <acl_target id="target2"/>
             <acl_target id="target1"/>
         </acls>
         """
     ))
예제 #5
0
 def test_target_id_is_not_unique_target_id(self):
     assert_raise_library_error(
         lambda: lib.create_target(self.cib.tree, "target2"),
         (
             severities.ERROR,
             report_codes.CIB_ACL_TARGET_ALREADY_EXISTS,
             {"target_id":"target2"}
         )
     )
예제 #6
0
def create_target(lib_env, target_id, role_list):
    """
    Create new target with id target_id and assign roles role_list to it.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of new target
    role_list -- list of roles to assign to new target
    """
    with cib_acl_section(lib_env) as acl_section:
        acl.assign_all_roles(acl_section, role_list,
                             acl.create_target(acl_section, target_id))
예제 #7
0
def create_target(lib_env, target_id, role_list):
    """
    Create new target with id target_id and assign roles role_list to it.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of new target
    role_list -- list of roles to assign to new target
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    _assign_roles_to_element(cib, acl.create_target(cib, target_id), role_list)
    lib_env.push_cib(cib)
예제 #8
0
파일: acl.py 프로젝트: jmartign/pcs
def create_target(lib_env, target_id, role_list):
    """
    Create new target with id target_id and assign roles role_list to it.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of new target
    role_list -- list of roles to assign to new target
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    _assign_roles_to_element(cib, acl.create_target(cib, target_id), role_list)
    lib_env.push_cib(cib)
예제 #9
0
파일: acl.py 프로젝트: HideoYamauchi/pcs
def create_target(lib_env, target_id, role_list):
    """
    Create new target with id target_id and assign roles role_list to it.
    Raises LibraryError on any failure.

    lib_env -- LibraryEnvironment
    target_id -- id of new target
    role_list -- list of roles to assign to new target
    """
    with cib_acl_section(lib_env) as acl_section:
        acl.assign_all_roles(
            acl_section,
            role_list,
            acl.create_target(acl_section, target_id)
        )