ovirt: Return ID for permissions facts (#39721)

pull/39725/head
Ondra Machacek 7 years ago committed by ansibot
parent 9eff1f1d74
commit dda31aa3f7

@ -94,7 +94,12 @@ from ansible.module_utils.ovirt import (
def _permissions_service(connection, module): def _permissions_service(connection, module):
if module.params['user_name']: if module.params['user_name']:
service = connection.system_service().users_service() service = connection.system_service().users_service()
entity = search_by_name(service, module.params['user_name']) entity = next(iter(service.list(search='usrname={}'.format(
'{}@{}'.format(module.params['user_name'], module.params['authz_name'])
)
)),
None
)
else: else:
service = connection.system_service().groups_service() service = connection.system_service().groups_service()
entity = search_by_name(service, module.params['group_name']) entity = search_by_name(service, module.params['group_name'])
@ -125,6 +130,7 @@ def main():
for key, value in p.__dict__.items(): for key, value in p.__dict__.items():
if value and isinstance(value, sdk.Struct): if value and isinstance(value, sdk.Struct):
newperm[key[1:]] = get_link_name(connection, value) newperm[key[1:]] = get_link_name(connection, value)
newperm['%s_id' % key[1:]] = value.id
permissions.append(newperm) permissions.append(newperm)
module.exit_json( module.exit_json(

Loading…
Cancel
Save