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)
|
||||
description:
|
||||
- The manageiq_group module supports adding, updating and deleting groups in ManageIQ.
|
||||
requirements:
|
||||
- manageiq-client
|
||||
|
||||
options:
|
||||
state:
|
||||
|
@ -319,10 +321,13 @@ class ManageIQgroup(object):
|
|||
"""
|
||||
try:
|
||||
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:
|
||||
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(
|
||||
changed=True,
|
||||
msg="deleted group %s with id %i" % (group['description'], group['id']))
|
||||
|
@ -610,7 +615,7 @@ def main():
|
|||
else:
|
||||
res_args = dict(
|
||||
changed=False,
|
||||
msg="group %s: does not exist in manageiq" % description)
|
||||
msg="group '%s' does not exist in manageiq" % description)
|
||||
|
||||
# group should exist
|
||||
if state == "present":
|
||||
|
|
Loading…
Reference in a new issue