Пример #1
0
        def load_role(entry):
            # Figure out the role name/version for the given entry.
            namespace = ns_utils.remove_resource_alias_namespace(entry.alias)
            name, version = name_utils.parse_role_namespace(namespace)

            # Load the role from the database and parse into the
            # template objects.
            db_role = self.template_store.retrieve_by_name(name, int(version))
            role = self._role_to_template_object(db_role)

            # Convert to the Tuskar domain model.
            tuskar_role = models.Role(db_role.uuid, name, version,
                                      role.description, role)
            return tuskar_role
Пример #2
0
        def load_role(entry):
            # Figure out the role name/version for the given entry.
            namespace = ns_utils.remove_resource_alias_namespace(entry.alias)
            name, version = name_utils.parse_role_namespace(namespace)

            # Load the role from the database and parse into the
            # template objects.
            db_role = self.template_store.retrieve_by_name(name, int(version))
            role = self._role_to_template_object(db_role)

            # Convert to the Tuskar domain model.
            tuskar_role = models.Role(db_role.uuid, name, version,
                                      role.description, role)
            return tuskar_role
Пример #3
0
 def test_parse_role_namespace_multiple_dash(self):
     name, version = name_utils.parse_role_namespace('all-in-one-v1')
     self.assertEqual('all-in-one', name)
     self.assertEqual('v1', version)
Пример #4
0
 def test_parse_role_namespace(self):
     name, version = name_utils.parse_role_namespace('r1-v1')
     self.assertEqual('r1', name)
     self.assertEqual('v1', version)
Пример #5
0
 def test_parse_role_namespace_multiple_dash(self):
     name, version = name_utils.parse_role_namespace('all-in-one-v1')
     self.assertEqual('all-in-one', name)
     self.assertEqual('v1', version)
Пример #6
0
 def test_parse_role_namespace(self):
     name, version = name_utils.parse_role_namespace('r1-v1')
     self.assertEqual('r1', name)
     self.assertEqual('v1', version)