mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed incorrect response removing a group (#55116)
This commit is contained in:
parent
9f87552f06
commit
daaea17801
1 changed files with 7 additions and 2 deletions
|
@ -35,6 +35,8 @@ version_added: '2.8'
|
||||||
author: Evert Mulder (@evertmulder)
|
author: Evert Mulder (@evertmulder)
|
||||||
description:
|
description:
|
||||||
- The manageiq_group module supports adding, updating and deleting groups in ManageIQ.
|
- The manageiq_group module supports adding, updating and deleting groups in ManageIQ.
|
||||||
|
requirements:
|
||||||
|
- manageiq-client
|
||||||
|
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
@ -319,10 +321,13 @@ class ManageIQgroup(object):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
url = '%s/groups/%s' % (self.api_url, group['id'])
|
url = '%s/groups/%s' % (self.api_url, group['id'])
|
||||||
self.client.post(url, action='delete')
|
result = self.client.post(url, action='delete')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(msg="failed to delete group %s: %s" % (group['description'], str(e)))
|
self.module.fail_json(msg="failed to delete group %s: %s" % (group['description'], str(e)))
|
||||||
|
|
||||||
|
if result['success'] is False:
|
||||||
|
self.module.fail_json(msg=result['message'])
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
changed=True,
|
changed=True,
|
||||||
msg="deleted group %s with id %i" % (group['description'], group['id']))
|
msg="deleted group %s with id %i" % (group['description'], group['id']))
|
||||||
|
@ -610,7 +615,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
res_args = dict(
|
res_args = dict(
|
||||||
changed=False,
|
changed=False,
|
||||||
msg="group %s: does not exist in manageiq" % description)
|
msg="group '%s' does not exist in manageiq" % description)
|
||||||
|
|
||||||
# group should exist
|
# group should exist
|
||||||
if state == "present":
|
if state == "present":
|
||||||
|
|
Loading…
Reference in a new issue