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:
parent
b7fb23b097
commit
bdf472a53f
@ -1,19 +1,36 @@
|
||||
---
|
||||
- name: Create keystone domain
|
||||
openstack.cloud.identity_domain:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ domain_name }}"
|
||||
description: "test description"
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ domain_name }}"
|
||||
description: "test description"
|
||||
register: os_domain
|
||||
|
||||
- name: Test output
|
||||
assert:
|
||||
that:
|
||||
- "'domain' in os_domain"
|
||||
- os_domain.domain.name == "{{ domain_name }}"
|
||||
- >-
|
||||
('enabled' in os_domain.domain.keys() and os_domain.domain['enabled']|bool) or
|
||||
('is_enabled' in os_domain.domain and os_domain.domain['is_enabled']|bool)
|
||||
- os_domain.domain.description == "test description"
|
||||
|
||||
- name: Update keystone domain
|
||||
openstack.cloud.identity_domain:
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ domain_name }}"
|
||||
description: "updated description"
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ domain_name }}"
|
||||
description: "updated description"
|
||||
register: os_domain_updated
|
||||
|
||||
- name: Test output
|
||||
assert:
|
||||
that:
|
||||
- os_domain_updated.domain.description == "updated description"
|
||||
|
||||
- name: Delete keystone domain
|
||||
openstack.cloud.identity_domain:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ domain_name }}"
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ domain_name }}"
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user