-
Notifications
You must be signed in to change notification settings - Fork 44
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
[Bug] [zos_copy] File wrongly modified after second zos_copy #737
Comments
We need Ansible dev to triage this, simply run the scenario and see if it is still an issue with our latest dev branch. From there we can figure out how to plan. |
I was unable to recreate the issue, see attached playbook to view how i attempted it. I ran it twice in a row (as-is) and also ran it with the commented out tasks in play, where i call
It may be helpful if you could try running my playbook and see if you get the same results. One thing to note, I had to remove the Note- had to attach my playbook as a text file. |
@vcorfmatibm - Since the issue has not had any updates since July 24th (past our 60 day retention) , we will close the issue. You can reopen and we will triage. |
@ddimatos I tried to execute the playbook [recreate.yml.txt] given by @ketankelkar. If I test with python 3.9 it's ok, the file is readable after the second copy. But with python 3.10 or 3.11, the file is not readable after the second copy |
@vcorfmatibm thank you for the update. |
While I verify on my end, @vcorfmatibm, would you mind running the recreate with the environment_vars:
_BPXK_AUTOCVT: "ON"
ZOAU_HOME: "{{ ZOAU }}"
#PYTHONPATH: "{{ ZOAU }}/lib"
LIBPATH: "{{ ZOAU }}/lib:{{ PYZ }}/lib:/lib:/usr/lib:."
PATH: "{{ ZOAU }}/bin:{{ PYZ }}/bin:/bin:/var/bin"
_CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
_TAG_REDIR_ERR: "txt"
_TAG_REDIR_IN: "txt"
_TAG_REDIR_OUT: "txt"
LANG: "C" |
With
Python 3.11.3 on the z/OS |
@ddimatos Hello ! What do we do with this problem ? Do you reopen this issue ? Do you open an other one ? Thanks by advance for your response |
Hi @vcorfmatibm - I am waiting to hear from @ketankelkar if what you are experiencing with python 3.10/3.11 is the same issue as #676 else we might need to create a new issue. |
Sorry for the delays folks, I was able to recreate the unreadable file on a 2nd zos_copy. Will be investigating further into the issue in the morning.
Took a look at the hex dump after each copy to see if anything stood out:
2nd zos_copy
File tagging seems to be intact for both copies. I used the same playbook I pasted above with:
|
Thanks for this update. We have high interest for a fix. |
While @ketankelkar is on PTO, I took their recreate and noticed a few things. I started by looking for a repeating hex value in the corrupt result, I noticed Corrupt hex values
Under a hunch, my guess is something told the code to use ISO8859-1 for the
Perform an inverted encoding conversion (error) in this step:
Now the file is corrupt, unreadable, hex values show a repeating pattern but unreadable and not any values I could correspond to which makes sense because the conversion was inverted.
I also divided this test into 2 playbooks to rule out anything that was happening by sharing a same runtime and still ended up with corrupt content. Next step is to investigate why this is happening. |
I have found the source of the issue, while we are investigating a dependency as the source of the issue, I do believe we have a work around for this, the work around will need to go through a full testing cycle and regression. I will update the issue once the dependency evaluates our findings. In the mean time, we will see who on the team has availability to put this fix in the next beta release |
The source of the issue is that a file is copied with
Dependency is working on this, but we will review implementing a work around. |
While I did not prepare a branch or a patch and only focused on one such
|
I put on a fix in #1064 after finding this also happens when copying a directory into an existing directory tree. The fix is aimed to be back ported into v1.8.0 too. |
Is there an existing issue for this?
Are the dependencies a supported version?
IBM Z Open Automation Utilities
v1.2.1
IBM Enterprise Python
v3.8.x
IBM z/OS Ansible core Version
v1.5.0
ansible-version
v2.11.x
z/OS version
v2.4
Ansible module
zos_copy
Bug description
Problem with zos_copy module when I copy a file from a uss directory to another uss directory when the file already exists in dest (Test also with version 1.4.0 and 1.5.0-beta.1 of Ansible z/OS core collection)
Here's my task:
zos_copy:
src: "/tmp/input/test2.txt"
dest: "/tmp/wd_uss/txt/test2.txt"
remote_src: true
mode: '0755'
backup: false
force: true
The content of the file to copy is :
Ceci n est que du text
After first copy, test2.txt content in tmp/wd_uss/txt is ok :
Ceci n est que du text
After second copy (/tmp/wd_uss/txt/test2.txt already exists), file is modified (content unreadable).
!! I don't touch the source, it's the same on the 1st and 2nd launch (/tmp/input/test2.txt)
For information :
ls -T /tmp/input/test2.txt ==>
t IBM-1047 T=on /tmp/input/test2.txt
ls -T /tmp/wd_uss/txt/test2.txt ==>
t IBM-1047 T=on /tmp/wd_uss/txt/test2.txt
When I run the task for the second time, the module returns "changed": true
Playbook verbosity output.
TASK [ibm.ibm_zos_wazi_deploy.zos_deploy : Test uss_copy] **************************************************************
task path: /mnt/c/Users/058275706/git/wazi-deploy-samples/translator/ansible/ansible_collections/ibm/ibm_zos_wazi_deploy/roles/zos_deploy/tasks/ibm_zos_collections/test.yml:16
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'echo ~vcorfma && sleep 0'"'"''
<9.30.222.103> (0, b'/u/vcorfma\n', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'( umask 77 && mkdir -p "
echo /u/vcorfma/.ansible/tmp
"&& mkdir "echo /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442
" && echo ansible-tmp-1681474911.0594854-304-278803071325442="echo /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442
" ) && sleep 0'"'"''<9.30.222.103> (0, b'ansible-tmp-1681474911.0594854-304-278803071325442=/u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442\n', b'')
Using module file /home/vcorfmat/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_copy.py
<9.30.222.103> PUT /home/vcorfmat/.ansible/tmp/ansible-local-182tsmuxyly/tmpncu3q_94 TO /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/AnsiballZ_zos_copy.py
<9.30.222.103> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' '[9.30.222.103]'
<9.30.222.103> (0, b'sftp> put /home/vcorfmat/.ansible/tmp/ansible-local-182tsmuxyly/tmpncu3q_94 /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/AnsiballZ_zos_copy.py\n', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'chmod u+x /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/ /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/AnsiballZ_zos_copy.py && sleep 0'"'"''
<9.30.222.103> (0, b'', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' -tt 9.30.222.103 '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/var/usr/lpp/IBM/zoautil LIBPATH=/var/usr/lpp/IBM/zoautil/lib:/var/usr/lpp/IBM/cyp/v3r10/pyz/lib:/lib:/usr/lib:. PATH=/var/usr/lpp/IBM/zoautil/bin:/var/usr/lpp/IBM/cyp/v3r10/pyz/bin:/bin:/var/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C /var/usr/lpp/IBM/cyp/v3r10/pyz/bin/python3 /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/AnsiballZ_zos_copy.py && sleep 0'"'"''
<9.30.222.103> (0, b'\r\n{"size": 23, "changed": false, "src": "/SYSTEM/tmp/input/test2.txt", "dest": "/tmp/wd_uss/txt/test2.txt", "ds_type": "USS", "dest_exists": true, "backup_name": null, "uid": 10149, "gid": 100, "owner": "VCORFMA", "group": "OMVS", "mode": "0755", "state": "file", "invocation": {"module_args": {"src": "/tmp/input/test2.txt", "dest": "/tmp/wd_uss/txt/test2.txt", "remote_src": true, "mode": "0755", "backup": false, "force": true, "is_uss": true, "is_pds": false, "is_src_dir": false, "copy_member": false, "src_member": false, "temp_path": null, "is_mvs_dest": false, "local_charset": "UTF-8", "is_binary": false, "local_follow": true, "ignore_sftp_stderr": false, "validate": false, "unsafe_writes": false, "encoding": null, "content": null, "backup_name": null, "volume": null, "dest_data_set": null, "size": null, "tmp_hlq": null, "owner": null, "group": null, "seuser": null, "serole": null, "selevel": null, "setype": null, "attributes": null}}}\r\n', b'Shared connection to 9.30.222.103 closed.\r\n')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'rm -f -r /u/vcorfma/.ansible/tmp/ansible-tmp-1681474911.0594854-304-278803071325442/ > /dev/null 2>&1 && sleep 0'"'"''
<9.30.222.103> (0, b'', b'')
ok: [zos_host_01] => {
"changed": false,
"dest": "/tmp/wd_uss/txt/test2.txt",
"gid": 100,
"group": "OMVS",
"invocation": {
"module_args": {
"backup": false,
"dest": "/tmp/wd_uss/txt/test2.txt",
"force": true,
"mode": "0755",
"remote_src": true,
"src": "/tmp/input/test2.txt"
}
},
"is_binary": false,
"mode": "0755",
"owner": "VCORFMA",
"size": 23,
"src": "/SYSTEM/tmp/input/test2.txt",
"state": "file",
"uid": 10149
}
Ansible configuration.
Contents of the inventory
Contents of
group_vars
orhost_vars
The text was updated successfully, but these errors were encountered: