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

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:
Evert Mulder 2019-04-12 19:25:33 +02:00 committed by ansibot
parent daaea17801
commit 39445786ff

View file

@ -35,7 +35,8 @@ version_added: '2.8'
author: Evert Mulder (@evertmulder)
description:
- The manageiq_tenant module supports adding, updating and deleting tenants in ManageIQ.
requirements:
- manageiq-client
options:
state:
description:
@ -264,6 +265,9 @@ class ManageIQTenant(object):
except Exception as 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'])
def edit_tenant(self, tenant, name, description):
@ -513,9 +517,14 @@ def main():
res_args = manageiq_tenant.delete_tenant(tenant)
# if we do not have a tenant, nothing to do
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(
changed=False,
msg="tenant %s: with parent: %i does not exist in manageiq" % (name, parent_id))
msg=msg)
# tenant should exist
if state == "present":