Move identity domain to use proxy layer

Make it compatible with new SDK and fix bug with "enabled"

Change-Id: I1f577fae27c24c257571d1cf90e49527470edace
This commit is contained in:
Sagi Shnaidman
2022-02-01 13:26:26 +02:00
parent b7fb23b097
commit bdf472a53f
2 changed files with 34 additions and 13 deletions

View File

@@ -104,7 +104,8 @@ class IdentityDomainModule(OpenStackModule):
if self.params['description'] is not None and \
domain.description != self.params['description']:
return True
if domain.enabled != self.params['enabled']:
if domain.get(
"is_enabled", domain.get("enabled")) != self.params['enabled']:
return True
return False
@@ -126,7 +127,7 @@ class IdentityDomainModule(OpenStackModule):
enabled = self.params['enabled']
state = self.params['state']
domains = self.conn.search_domains(filters=dict(name=name))
domains = list(self.conn.identity.domains(name=name))
if len(domains) > 1:
self.fail_json(msg='Domain name %s is not unique' % name)
@@ -151,7 +152,10 @@ class IdentityDomainModule(OpenStackModule):
changed = True
else:
changed = False
self.exit_json(changed=changed, domain=domain, id=domain.id)
if hasattr(domain, "to_dict"):
domain = domain.to_dict()
domain.pop("location")
self.exit_json(changed=changed, domain=domain, id=domain['id'])
elif state == 'absent':
if domain is None: