Skip to content

Commit

Permalink
mksysb: improve visibility on the output (ansible-collections#6269)
Browse files Browse the repository at this point in the history
* mksysb: improve visibility on the output

* add changelog frag
  • Loading branch information
russoz authored Apr 5, 2023
1 parent 7d19eca commit a64e368
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/6269-mksysb-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- mksysb - improved the output of the module in case of errors (https://github.com/ansible-collections/community.general/issues/6263).
5 changes: 3 additions & 2 deletions plugins/modules/mksysb.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ def __init_module__(self):
def __run__(self):
def process(rc, out, err):
if rc != 0:
self.do_raise("mksysb failed.")
self.vars.msg = out
self.do_raise("mksysb failed: {0}".format(out))

runner = CmdRunner(
self.module,
Expand All @@ -158,6 +157,8 @@ def process(rc, out, err):
'extended_attrs', 'backup_crypt_files', 'backup_dmapi_fs', 'new_image_data', 'combined_path'],
output_process=process, check_mode_skip=True) as ctx:
ctx.run(combined_path=[self.vars.storage_path, self.vars.name])
if self.verbosity >= 4:
self.vars.run_info = ctx.run_info

self.changed = True

Expand Down

0 comments on commit a64e368

Please sign in to comment.