Skip to content

Commit ffc1208

Browse files
authored
Fix api_command() failure handling: for other-than-200 http code, if command is 'show-..', then return Ansible module.fail_json instead of discard_and_fail. All others still discard_and_fail. (#148)
1 parent 28270cb commit ffc1208

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugins/module_utils/checkpoint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,10 @@ def api_command(module, command):
564564

565565
handle_publish(module, connection, version)
566566
else:
567-
discard_and_fail(module, code, response, connection, version)
567+
if command.startswith("show"):
568+
module.fail_json(msg=parse_fail_message(code, response))
569+
else:
570+
discard_and_fail(module, code, response, connection, version)
568571

569572
return result
570573

0 commit comments

Comments
 (0)