Fixed incorrect response removing a group (#55116)

This commit is contained in:
Evert Mulder 2019-04-12 19:25:18 +02:00 committed by ansibot
parent 9f87552f06
commit daaea17801

View file

@ -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":