Bugfixes when removing a tenant- Module reported changed when tenant was not removed.- Script error when removing a non existing tenant without parent_id (#55110)
This commit is contained in:
parent
daaea17801
commit
39445786ff
1 changed files with 11 additions and 2 deletions
|
@ -35,7 +35,8 @@ version_added: '2.8'
|
||||||
author: Evert Mulder (@evertmulder)
|
author: Evert Mulder (@evertmulder)
|
||||||
description:
|
description:
|
||||||
- The manageiq_tenant module supports adding, updating and deleting tenants in ManageIQ.
|
- The manageiq_tenant module supports adding, updating and deleting tenants in ManageIQ.
|
||||||
|
requirements:
|
||||||
|
- manageiq-client
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
|
@ -264,6 +265,9 @@ class ManageIQTenant(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(msg="failed to delete tenant %s: %s" % (tenant['name'], str(e)))
|
self.module.fail_json(msg="failed to delete tenant %s: %s" % (tenant['name'], str(e)))
|
||||||
|
|
||||||
|
if result['success'] is False:
|
||||||
|
self.module.fail_json(msg=result['message'])
|
||||||
|
|
||||||
return dict(changed=True, msg=result['message'])
|
return dict(changed=True, msg=result['message'])
|
||||||
|
|
||||||
def edit_tenant(self, tenant, name, description):
|
def edit_tenant(self, tenant, name, description):
|
||||||
|
@ -513,9 +517,14 @@ def main():
|
||||||
res_args = manageiq_tenant.delete_tenant(tenant)
|
res_args = manageiq_tenant.delete_tenant(tenant)
|
||||||
# if we do not have a tenant, nothing to do
|
# if we do not have a tenant, nothing to do
|
||||||
else:
|
else:
|
||||||
|
if parent_id:
|
||||||
|
msg = "tenant '%s' with parent_id %i does not exist in manageiq" % (name, parent_id)
|
||||||
|
else:
|
||||||
|
msg = "tenant '%s' with parent '%s' does not exist in manageiq" % (name, parent)
|
||||||
|
|
||||||
res_args = dict(
|
res_args = dict(
|
||||||
changed=False,
|
changed=False,
|
||||||
msg="tenant %s: with parent: %i does not exist in manageiq" % (name, parent_id))
|
msg=msg)
|
||||||
|
|
||||||
# tenant should exist
|
# tenant should exist
|
||||||
if state == "present":
|
if state == "present":
|
||||||
|
|
Loading…
Reference in a new issue