Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 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/2232_Update_zos_copy_interface.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
breaking_changes:
- zos_copy - Option ``force_lock`` is deprecated in favor of ``force``. Option ``force`` is deprecated in favor of ``replace``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little awkward: force_lock->force->replace seems confusing. Why not reword as (force_lock and force are deprecated in favor of replace).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.

Option ``executable`` is deprecated in favor of ``is_executable``. Now return value ``dest_created`` is always return with bool value.
(https://github.com/ansible-collections/ibm_zos_core/pull/2232).
16 changes: 8 additions & 8 deletions plugins/action/zos_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ def run(self, tmp=None, task_vars=None):
dest = task_args.get('dest', None)
content = task_args.get('content', None)

force = _process_boolean(task_args.get('force'), default=True)
replace = _process_boolean(task_args.get('replace'), default=True)
backup = _process_boolean(task_args.get('backup'), default=False)
local_follow = _process_boolean(task_args.get('local_follow'), default=False)
remote_src = _process_boolean(task_args.get('remote_src'), default=False)
is_binary = _process_boolean(task_args.get('is_binary'), default=False)
force_lock = _process_boolean(task_args.get('force_lock'), default=False)
executable = _process_boolean(task_args.get('executable'), default=False)
force = _process_boolean(task_args.get('force'), default=False)
is_executable = _process_boolean(task_args.get('is_executable'), default=False)
asa_text = _process_boolean(task_args.get('asa_text'), default=False)
ignore_sftp_stderr = _process_boolean(task_args.get("ignore_sftp_stderr"), default=True)
backup_name = task_args.get("backup_name", None)
Expand Down Expand Up @@ -116,8 +116,8 @@ def run(self, tmp=None, task_vars=None):
msg = "Both 'is_binary' and 'asa_text' are True. Unable to copy binary data as an ASA text file."
return self._exit_action(result, msg, failed=True)

if executable and asa_text:
msg = "Both 'executable' and 'asa_text' are True. Unable to copy an executable as an ASA text file."
if is_executable and asa_text:
msg = "Both 'is_executable' and 'asa_text' are True. Unable to copy an is_executable as an ASA text file."
return self._exit_action(result, msg, failed=True)

use_template = _process_boolean(task_args.get("use_template"), default=False)
Expand All @@ -130,9 +130,9 @@ def run(self, tmp=None, task_vars=None):
msg = "Cannot specify 'mode', 'owner' or 'group' for MVS destination"
return self._exit_action(result, msg, failed=True)

if force_lock:
if force:
display.warning(
msg="Using force_lock uses operations that are subject to race conditions and can lead to data loss, use with caution.")
msg="Using force uses operations that are subject to race conditions and can lead to data loss, use with caution.")
template_dir = None

if not remote_src:
Expand Down Expand Up @@ -293,7 +293,7 @@ def run(self, tmp=None, task_vars=None):
path = os.path.normpath(f"{self.tmp_dir}/ansible-zos-copy")
rm_res = self._connection.exec_command(f"rm -rf {path}*")

if copy_res.get("note") and not force:
if copy_res.get("note") and not replace:
result["note"] = copy_res.get("note")
return result

Expand Down
6 changes: 3 additions & 3 deletions plugins/module_utils/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def copy_vsam_ps(src, dest, tmphlq=None):
return rc, out, err


def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
def copy_asa_uss2mvs(src, dest, tmphlq=None, force=False):
"""Copy a file from USS to an ASA sequential data set or PDS/E member.

Parameters
Expand All @@ -220,7 +220,7 @@ def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
The MVS destination data set or member.
tmphlq : str
High Level Qualifier for temporary datasets.
force_lock : bool
force : bool
Whether to open the destination in SHR mode.

Returns
Expand All @@ -236,7 +236,7 @@ def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
# Removes escaping to execute this command
dest = dest.replace('\\', '')
src = src.replace('\\', '')
dest_dsp = "shr" if force_lock else "old"
dest_dsp = "shr" if force else "old"

ocopy_cmd = "OCOPY INDD(DSSRC) OUTDD(DSTAR) TEXT"
ocopy_dds = {
Expand Down
Loading