From a64e36820fb391a864f8850bebf254728bc4c847 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Wed, 5 Apr 2023 23:55:49 +1200 Subject: [PATCH] mksysb: improve visibility on the output (#6269) * mksysb: improve visibility on the output * add changelog frag --- changelogs/fragments/6269-mksysb-output.yml | 2 ++ plugins/modules/mksysb.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/6269-mksysb-output.yml diff --git a/changelogs/fragments/6269-mksysb-output.yml b/changelogs/fragments/6269-mksysb-output.yml new file mode 100644 index 0000000000..16ba6257cf --- /dev/null +++ b/changelogs/fragments/6269-mksysb-output.yml @@ -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). diff --git a/plugins/modules/mksysb.py b/plugins/modules/mksysb.py index c43a268f33..8272dbf7de 100644 --- a/plugins/modules/mksysb.py +++ b/plugins/modules/mksysb.py @@ -146,8 +146,7 @@ class MkSysB(ModuleHelper): 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, @@ -158,6 +157,8 @@ class MkSysB(ModuleHelper): '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