From 0eda120eeddbccfba58878a065f56c26b722379c Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Thu, 2 Nov 2023 18:16:59 -0600 Subject: [PATCH 1/5] Added a temp cleanup --- plugins/modules/zos_unarchive.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/zos_unarchive.py b/plugins/modules/zos_unarchive.py index be7c93f5c..ba41005b2 100644 --- a/plugins/modules/zos_unarchive.py +++ b/plugins/modules/zos_unarchive.py @@ -881,6 +881,7 @@ def unpack(self, src, dest): """.format(src, dest) rc, out, err = mvs_cmd.ikjeft01(cmd=unpack_cmd, authorized=True) if rc != 0: + self.clean_environment(data_sets=[dest], uss_files=[], remove_targets=True) self.module.fail_json( msg="Failed executing RECEIVE to restore {0} into {1}".format(src, dest), stdout=out, From 0c9aee44f99e6faf414ce525afea2a82a05c39a8 Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Thu, 2 Nov 2023 18:20:23 -0600 Subject: [PATCH 2/5] Added changelog --- changelogs/fragments/1047-xmit-temporary-residual.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/1047-xmit-temporary-residual.yml diff --git a/changelogs/fragments/1047-xmit-temporary-residual.yml b/changelogs/fragments/1047-xmit-temporary-residual.yml new file mode 100644 index 000000000..d45fc2b47 --- /dev/null +++ b/changelogs/fragments/1047-xmit-temporary-residual.yml @@ -0,0 +1,4 @@ +bugfixes: + - zos_unarchive - When zos_unarchive fails during RECEIVE command it does not clean the + temporary data sets created. Fix now removes the temporary data sets. + () \ No newline at end of file From 31a84c626e89bc8559011cd781d2279187354be8 Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Thu, 2 Nov 2023 18:22:26 -0600 Subject: [PATCH 3/5] Modified changelog --- changelogs/fragments/1049-xmit-temporary-residual.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/1049-xmit-temporary-residual.yml diff --git a/changelogs/fragments/1049-xmit-temporary-residual.yml b/changelogs/fragments/1049-xmit-temporary-residual.yml new file mode 100644 index 000000000..d24059ec1 --- /dev/null +++ b/changelogs/fragments/1049-xmit-temporary-residual.yml @@ -0,0 +1,4 @@ +bugfixes: + - zos_unarchive - When zos_unarchive fails during RECEIVE command it does not clean the + temporary data sets created. Fix now removes the temporary data sets. + (https://github.com/ansible-collections/ibm_zos_core/pull/1049). \ No newline at end of file From 26daf2c8a859dc8000d7de11af1651c9def1a129 Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Fri, 3 Nov 2023 15:22:23 -0600 Subject: [PATCH 4/5] Added removal of src if remote_src is False Signed-off-by: Fernando Flores --- plugins/modules/zos_unarchive.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/modules/zos_unarchive.py b/plugins/modules/zos_unarchive.py index ba41005b2..81737ed29 100644 --- a/plugins/modules/zos_unarchive.py +++ b/plugins/modules/zos_unarchive.py @@ -853,7 +853,8 @@ def unpack(self, src, dest): dds = {'args': 'UNPACK', 'sysut1': src, 'sysut2': dest} rc, out, err = mvs_cmd.amaterse(cmd="", dds=dds) if rc != 0: - self.clean_environment(data_sets=[dest], uss_files=[], remove_targets=True) + ds_remove_list = [dest, src] if not self.remote_src else [dest] + self.clean_environment(data_sets=ds_remove_list, uss_files=[], remove_targets=True) self.module.fail_json( msg="Failed executing AMATERSE to restore {0} into {1}".format(src, dest), stdout=out, @@ -881,7 +882,8 @@ def unpack(self, src, dest): """.format(src, dest) rc, out, err = mvs_cmd.ikjeft01(cmd=unpack_cmd, authorized=True) if rc != 0: - self.clean_environment(data_sets=[dest], uss_files=[], remove_targets=True) + ds_remove_list = [dest, src] if not self.remote_src else [dest] + self.clean_environment(data_sets=ds_remove_list, uss_files=[], remove_targets=True) self.module.fail_json( msg="Failed executing RECEIVE to restore {0} into {1}".format(src, dest), stdout=out, From 866e43807fb927c403c40ff34d8a5eec92b55782 Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Mon, 6 Nov 2023 11:16:14 -0600 Subject: [PATCH 5/5] Modified changelog fragments --- changelogs/fragments/1047-xmit-temporary-residual.yml | 4 ---- ...mporary-residual.yml => 1049-xmit-temporary-data-sets.yml} | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 changelogs/fragments/1047-xmit-temporary-residual.yml rename changelogs/fragments/{1049-xmit-temporary-residual.yml => 1049-xmit-temporary-data-sets.yml} (58%) diff --git a/changelogs/fragments/1047-xmit-temporary-residual.yml b/changelogs/fragments/1047-xmit-temporary-residual.yml deleted file mode 100644 index d45fc2b47..000000000 --- a/changelogs/fragments/1047-xmit-temporary-residual.yml +++ /dev/null @@ -1,4 +0,0 @@ -bugfixes: - - zos_unarchive - When zos_unarchive fails during RECEIVE command it does not clean the - temporary data sets created. Fix now removes the temporary data sets. - () \ No newline at end of file diff --git a/changelogs/fragments/1049-xmit-temporary-residual.yml b/changelogs/fragments/1049-xmit-temporary-data-sets.yml similarity index 58% rename from changelogs/fragments/1049-xmit-temporary-residual.yml rename to changelogs/fragments/1049-xmit-temporary-data-sets.yml index d24059ec1..5ef0f2078 100644 --- a/changelogs/fragments/1049-xmit-temporary-residual.yml +++ b/changelogs/fragments/1049-xmit-temporary-data-sets.yml @@ -1,4 +1,4 @@ bugfixes: - - zos_unarchive - When zos_unarchive fails during RECEIVE command it does not clean the + - zos_unarchive - When zos_unarchive fails during unpack either with xmit or terse it does not clean the temporary data sets created. Fix now removes the temporary data sets. (https://github.com/ansible-collections/ibm_zos_core/pull/1049). \ No newline at end of file