Skip to content

Commit

Permalink
Fail if systemd generation failed and it's explicitly set
Browse files Browse the repository at this point in the history
Fix #675

If we explicitly set to generate systemd with parameters, fail
the module if the generation failed.

Signed-off-by: Sagi Shnaidman <[email protected]>
  • Loading branch information
sshnaidm committed Nov 30, 2023
1 parent c3b38b5 commit fb27f88
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/module_utils/podman/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def generate_systemd(module, module_params, name, version):
if rc != 0:
module.log(
"PODMAN-CONTAINER-DEBUG: Error generating systemd: %s" % err)
if sysconf:
module.fail_json(msg="Error generating systemd: %s" % err)
return result
else:
try:
Expand Down Expand Up @@ -194,6 +196,8 @@ def generate_systemd(module, module_params, name, version):
except Exception as e:
module.log(
"PODMAN-CONTAINER-DEBUG: Error writing systemd: %s" % e)
if sysconf:
module.fail_json(msg="Error writing systemd: %s" % e)
return result


Expand Down

0 comments on commit fb27f88

Please sign in to comment.