ansible-collections/ansible.windows

win_copy doesnt work when folder name has special character

periyasamy003 opened this issue · 3 comments

SUMMARY

Tasks are failing when the folder name has special characters.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_copy

ANSIBLE VERSION
ansible-2.9.9
COLLECTION VERSION

CONFIGURATION

OS / ENVIRONMENT

Client--> Linux (Jenkins worker node)
Target --> Windows server

STEPS TO REPRODUCE
  • name: Copy files from workspace with special characters
    win_copy:
    src: '{{ WORKSPACE }}/[...slug]/' # Using escape character
    dest: 'C:\tmp'
    exclude: ['.git']
    force: no
EXPECTED RESULTS
ACTUAL RESULTS
TASK [Copy files from workspace with special characters] **************************
fatal: [win_server]: FAILED! => {"changed": true, "dest": "C:\\tmp", "module_stderr": "An error occurred while creating the pipeline.\r\n    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n    + FullyQualifiedErrorId : RuntimeException\r\n \r\nException calling \"Run\" with \"1\" argument(s): \"Exception calling \"Invoke\" with \"0\" argument(s): \"The running command st\r\nopped because the preference variable \"ErrorActionPreference\" or common parameter is set to Stop: An item with the spec\r\nified name C:\\tmp\\[...slug] already exists.\"\"\r\nAt line:93 char:5\r\n+     $output = $entrypoint.Run($payload)\r\n+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException\r\n    + FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n \r\n", "module_stdout": "", "msg": "MODULE FAILURE", "operation": "folder_copy", "rc": 1, "src": "/opt/jenkins/workspace/"}

Can you try a newer version of Ansible and subsequently a newer version of this collection. 2.9 is quite old and the win_copy for that code predated this collection. I also believe I fixed this issue at some point but I’m not 100% sure on that.

I tested same scenario with ansible-core 2.15.10 but it is working as expected. I'm assuming this is fixed on current ansible version