1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: fix domain name is not unique, use full path

This commit is contained in:
Rene Moser 2015-06-26 09:24:02 +02:00
parent b9b1e294d7
commit 7952723530
2 changed files with 8 additions and 6 deletions

View file

@ -274,12 +274,13 @@ class AnsibleCloudStack:
return None
args = {}
args['name'] = domain
args['listall'] = True
domains = self.cs.listDomains(**args)
if domains:
self.domain = domains['domain'][0]
return self._get_by_key(key, self.domain)
for d in domains['domain']:
if d['path'].lower() in [ domain.lower(), "root/" + domain.lower(), "root" + domain.lower() ]:
self.domain = d
return self._get_by_key(key, self.domain)
self.module.fail_json(msg="Domain '%s' not found" % domain)

View file

@ -274,12 +274,13 @@ class AnsibleCloudStack:
return None
args = {}
args['name'] = domain
args['listall'] = True
domains = self.cs.listDomains(**args)
if domains:
self.domain = domains['domain'][0]
return self._get_by_key(key, self.domain)
for d in domains['domain']:
if d['path'].lower() in [ domain.lower(), "root/" + domain.lower(), "root" + domain.lower() ]:
self.domain = d
return self._get_by_key(key, self.domain)
self.module.fail_json(msg="Domain '%s' not found" % domain)