mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-04-27 17:06:57 +00:00
Backported changes to identity_domain_info from master branch
Added ci integration tests and updated return value documentation.
Reverted function calls which would break backward compatibility
with previous collection releases.
Change-Id: Ic7915fd3334266783ea5e9d442ef304fa734ca00
(cherry picked from commit b31fdf8320)
This commit is contained in:
@@ -18,7 +18,7 @@ options:
|
||||
type: str
|
||||
filters:
|
||||
description:
|
||||
- A dictionary of meta data to use for further filtering. Elements of
|
||||
- A dictionary of meta data to use for filtering. Elements of
|
||||
this dictionary may be additional dictionaries.
|
||||
type: dict
|
||||
requirements:
|
||||
@@ -61,7 +61,8 @@ RETURN = '''
|
||||
openstack_domains:
|
||||
description: has all the OpenStack information about domains
|
||||
returned: always, but can be null
|
||||
type: complex
|
||||
type: list
|
||||
elements: dict
|
||||
contains:
|
||||
id:
|
||||
description: Unique UUID.
|
||||
@@ -89,10 +90,8 @@ class IdentityDomainInfoModule(OpenStackModule):
|
||||
name=dict(required=False, default=None),
|
||||
filters=dict(required=False, type='dict', default=None),
|
||||
)
|
||||
|
||||
module_kwargs = dict(
|
||||
mutually_exclusive=[
|
||||
['name', 'filters'],
|
||||
],
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
||||
@@ -100,18 +99,14 @@ class IdentityDomainInfoModule(OpenStackModule):
|
||||
|
||||
def run(self):
|
||||
name = self.params['name']
|
||||
filters = self.params['filters']
|
||||
filters = self.params['filters'] or {}
|
||||
|
||||
args = {}
|
||||
if name:
|
||||
# Let's suppose user is passing domain ID
|
||||
try:
|
||||
domains = self.conn.get_domain(name)
|
||||
except Exception:
|
||||
domains = self.conn.search_domains(filters={'name': name})
|
||||
|
||||
else:
|
||||
domains = self.conn.search_domains(filters)
|
||||
args['name_or_id'] = name
|
||||
args['filters'] = filters
|
||||
|
||||
domains = self.conn.search_domains(**args)
|
||||
self.exit_json(changed=False, openstack_domains=domains)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user