Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean temporary data sets created during XMIT unarchive operation #1049

Merged
merged 6 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/1049-xmit-temporary-data-sets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bugfixes:
- 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).
5 changes: 4 additions & 1 deletion plugins/modules/zos_unarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -881,6 +882,8 @@ def unpack(self, src, dest):
""".format(src, dest)
rc, out, err = mvs_cmd.ikjeft01(cmd=unpack_cmd, authorized=True)
if rc != 0:
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,
Expand Down