Skip to content

Commit

Permalink
Fixed error for when copying from src that is more than 80 lenght and…
Browse files Browse the repository at this point in the history
… dest is asa would fail
  • Loading branch information
fernandofloresg committed Oct 4, 2024
1 parent b18455d commit 78df07b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions plugins/module_utils/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ def copy_asa_uss2mvs(src, dest):
str
The stderr after the copy command executed successfully.
"""
oget_cmd = "OGET '{0}' '{1}'".format(src, dest)
rc, out, err = ikjeft01(oget_cmd, authorized=True)

module = AnsibleModuleHelper(argument_spec={})
oget_cmd = f"tsocmd \" OGET '{src}' '{dest}' \""
rc, out, err = module.run_command(oget_cmd)

return TSOCmdResponse(rc, out, err)

Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/zos_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def convert_encoding(self, src, encoding, remote_src):
else:
try:
if remote_src:
fd, temp_src = tempfile.mkstemp(prefix=os.environ['TMP'])
fd, temp_src = tempfile.mkstemp(dir=os.environ['TMP'])
os.close(fd)
shutil.copy(new_src, temp_src)
new_src = temp_src
Expand Down Expand Up @@ -1458,7 +1458,7 @@ def create_temp_with_lf_endings(self, src):
If the conversion fails.
"""
try:
fd, converted_src = tempfile.mkstemp(prefix=os.environ['TMP'])
fd, converted_src = tempfile.mkstemp(dir=os.environ['TMP'])
os.close(fd)

with open(converted_src, "wb") as converted_file:
Expand Down Expand Up @@ -2216,7 +2216,7 @@ def dump_data_set_member_to_file(data_set_member, is_binary):
DataSetMemberAttributeError
When the call to dcp fails.
"""
fd, temp_path = tempfile.mkstemp(prefix=os.environ['TMP'])
fd, temp_path = tempfile.mkstemp(dir=os.environ['TMP'])
os.close(fd)

copy_args = dict()
Expand Down Expand Up @@ -3116,7 +3116,7 @@ def normalize_line_endings(src, encoding=None):
src_tag = encoding["from"]

if src_tag != "IBM-037":
fd, converted_src = tempfile.mkstemp(prefix=os.environ['TMP'])
fd, converted_src = tempfile.mkstemp(dir=os.environ['TMP'])
os.close(fd)

enc_utils.uss_convert_encoding(
Expand Down Expand Up @@ -3350,7 +3350,7 @@ def run_module(module, arg_def):
src_tag = encode.Defaults.get_default_system_charset()

# Converting the original src to a temporary one in UTF-8.
fd, converted_src = tempfile.mkstemp(prefix=os.environ['TMP'])
fd, converted_src = tempfile.mkstemp(dir=os.environ['TMP'])
os.close(fd)
encode_utils.uss_convert_encoding(
new_src,
Expand Down

0 comments on commit 78df07b

Please sign in to comment.