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

[Enabler] [zos_copy] Use ZOAU's force option during copies #1488

Merged
merged 4 commits into from
May 8, 2024
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/1488-zos_copy-refactor-force.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trivial:
- zos_copy - use keyword argument force when copying data sets, instead
of a dictionary.
(https://github.com/ansible-collections/ibm_zos_core/pull/1488).
10 changes: 2 additions & 8 deletions plugins/modules/zos_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,11 +948,8 @@ def copy_to_seq(
if self.is_binary or self.asa_text:
copy_args["options"] = "-B"

if self.force_lock:
copy_args["options"] += " -f"

try:
datasets.copy(new_src, dest, **copy_args)
datasets.copy(new_src, dest, force=self.force_lock, **copy_args)
except zoau_exceptions.ZOAUException as copy_exception:
raise CopyOperationError(
msg="Unable to copy source {0} to {1}".format(new_src, dest),
Expand Down Expand Up @@ -1815,11 +1812,8 @@ def copy_to_member(
if self.is_binary or self.asa_text:
opts["options"] = "-B"

if self.force_lock:
opts["options"] += " -f"

try:
rc = datasets.copy(src, dest, alias=self.aliases, executable=self.executable, **opts)
rc = datasets.copy(src, dest, alias=self.aliases, executable=self.executable, force=self.force_lock, **opts)
out = ""
err = ""
except zoau_exceptions.ZOAUException as copy_exception:
Expand Down