A method in serverroles server plugin uses is to compare two strings. attr.associated_role and role are strings. The code just happens to work because the strings are defined in the same module and scope, so Python reuses the string object. The problem prevents me to extend server roles with additional associate objects.
is
attr.associated_role
role
https://pagure.io/freeipa/blob/e5819bcae6779b89b6d11a144f293a4838344738/f/ipaserver/plugins/serverroles.py#_112
def _get_assoc_attributes(self, role_name): role = self._get_role(role_name) assoc_attributes = { name: attr for name, attr in self.attributes.items() if attr.associated_role is role}
servroles.role_instancesand servroles.attribute_instances are defined as tuples. This makes it also complicated to add additional roles and associated roles with a server plugin.
servroles.role_instances
servroles.attribute_instances
All Fedora and RHEL versions with 4.9.11+ and 4.10.1+ are affected
Ignore the ticket, I misread the code. associated_role is a property that returns a ServiceBasedRole instance.
associated_role
ServiceBasedRole
>>> from ipaserver import servroles >>> servroles.attribute_instances[2].associated_role <ipaserver.servroles.ServiceBasedRole object at 0x7f142a443c10> >>> servroles.attribute_instances[2].associated_role.name 'IPA master'
Metadata Update from @cheimes: - Issue close_status updated to: invalid - Issue status updated to: Closed (was: Open)