fix os_user_role for groups in multidomain context

This fixes searching for a group in multi-domain context by passing the
domain_id in the call to get_groups.

original github PR: https://github.com/ansible/ansible/pull/62858

Change-Id: Ia2216728c15cc9d9a5e29bfe6b9fc63d2c6982ce
Task: 38375
Story: 2007209
This commit is contained in:
Bram Verschueren
2020-01-23 08:22:46 +01:00
parent 4c03ae0c16
commit c7506b5b10

View File

@@ -156,7 +156,10 @@ def main():
module.fail_json(msg="User %s is not valid" % user)
filters['user'] = u['id']
if group:
g = cloud.get_group(group)
if domain:
g = cloud.get_group(group, domain_id=filters['domain'])
else:
g = cloud.get_group(group)
if g is None:
module.fail_json(msg="Group %s is not valid" % group)
filters['group'] = g['id']