Skip to content

Commit 73190da

Browse files
AndreMarcel99André Marcel Gutiérrez Benítezfernandofloresg
authored
[Enabler][2142]update_zos_copy_interface (#2232)
* Test * Alter names * Remove and add values to parameter validation * Replace on test suite * Replace fix * Add option to replace to work properly * Debug * Fix checksum * Fix pushed checksum * Fix copy * Fix changes on job utilities * Debug test * Debug test * Complete validation * Validate copy * Fix copy allocate * Fix testing validations * Fix str * Debug * Debug line * Debug * Return copy for zoau call * Try validate force work * Add fragment * Try validate force work * Fix sanity * Modify fragment * Update plugins/modules/zos_copy.py Co-authored-by: Fernando Flores <[email protected]> --------- Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]> Co-authored-by: Fernando Flores <[email protected]>
1 parent 26453eb commit 73190da

File tree

5 files changed

+572
-286
lines changed

5 files changed

+572
-286
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
breaking_changes:
2+
- zos_copy - Option ``force_lock`` is deprecated in favor of ``force`` for using datasets on dsp=shr.
3+
Option ``force`` is deprecated in favor of ``replace`` for cases you want to replace a dest already exists.
4+
Option ``executable`` is deprecated in favor of ``is_executable``.
5+
Now return value ``dest_created`` is always return with bool value.
6+
(https://github.com/ansible-collections/ibm_zos_core/pull/2232).

plugins/action/zos_copy.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def run(self, tmp=None, task_vars=None):
5151
dest = task_args.get('dest', None)
5252
content = task_args.get('content', None)
5353

54-
force = _process_boolean(task_args.get('force'), default=True)
54+
replace = _process_boolean(task_args.get('replace'), default=True)
5555
backup = _process_boolean(task_args.get('backup'), default=False)
5656
local_follow = _process_boolean(task_args.get('local_follow'), default=False)
5757
remote_src = _process_boolean(task_args.get('remote_src'), default=False)
5858
is_binary = _process_boolean(task_args.get('is_binary'), default=False)
59-
force_lock = _process_boolean(task_args.get('force_lock'), default=False)
60-
executable = _process_boolean(task_args.get('executable'), default=False)
59+
force = _process_boolean(task_args.get('force'), default=False)
60+
is_executable = _process_boolean(task_args.get('is_executable'), default=False)
6161
asa_text = _process_boolean(task_args.get('asa_text'), default=False)
6262
ignore_sftp_stderr = _process_boolean(task_args.get("ignore_sftp_stderr"), default=True)
6363
backup_name = task_args.get("backup_name", None)
@@ -116,8 +116,8 @@ def run(self, tmp=None, task_vars=None):
116116
msg = "Both 'is_binary' and 'asa_text' are True. Unable to copy binary data as an ASA text file."
117117
return self._exit_action(result, msg, failed=True)
118118

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

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

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

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

296-
if copy_res.get("note") and not force:
296+
if copy_res.get("note") and not replace:
297297
result["note"] = copy_res.get("note")
298298
return result
299299

plugins/module_utils/copy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def copy_vsam_ps(src, dest, tmphlq=None):
209209
return rc, out, err
210210

211211

212-
def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
212+
def copy_asa_uss2mvs(src, dest, tmphlq=None, force=False):
213213
"""Copy a file from USS to an ASA sequential data set or PDS/E member.
214214
215215
Parameters
@@ -220,7 +220,7 @@ def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
220220
The MVS destination data set or member.
221221
tmphlq : str
222222
High Level Qualifier for temporary datasets.
223-
force_lock : bool
223+
force : bool
224224
Whether to open the destination in SHR mode.
225225
226226
Returns
@@ -236,7 +236,7 @@ def copy_asa_uss2mvs(src, dest, tmphlq=None, force_lock=False):
236236
# Removes escaping to execute this command
237237
dest = dest.replace('\\', '')
238238
src = src.replace('\\', '')
239-
dest_dsp = "shr" if force_lock else "old"
239+
dest_dsp = "shr" if force else "old"
240240

241241
ocopy_cmd = "OCOPY INDD(DSSRC) OUTDD(DSTAR) TEXT"
242242
ocopy_dds = {

0 commit comments

Comments
 (0)