Skip to content

Commit

Permalink
Fix api_command() failure handling: for other-than-200 http code, if …
Browse files Browse the repository at this point in the history
…command is 'show-..', then return Ansible module.fail_json instead of discard_and_fail. All others still discard_and_fail. (#148)
  • Loading branch information
duanetoler authored Sep 15, 2024
1 parent 28270cb commit ffc1208
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/module_utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,10 @@ def api_command(module, command):

handle_publish(module, connection, version)
else:
discard_and_fail(module, code, response, connection, version)
if command.startswith("show"):
module.fail_json(msg=parse_fail_message(code, response))
else:
discard_and_fail(module, code, response, connection, version)

return result

Expand Down

0 comments on commit ffc1208

Please sign in to comment.