Skip to content
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

synchronize can't handle paths with spaces in them #305

Open
azhelev opened this issue Dec 30, 2021 · 3 comments
Open

synchronize can't handle paths with spaces in them #305

azhelev opened this issue Dec 30, 2021 · 3 comments
Labels
has_pr needs_info synchronize Issue and PR for synchronize module verified This issue has been verified/reproduced by maintainer

Comments

@azhelev
Copy link

azhelev commented Dec 30, 2021

SUMMARY

synchronize can't handle paths with spaces in them

ISSUE TYPE
  • Bug Report
COMPONENT NAME

synchronize

ANSIBLE VERSION
ansible [core 2.12.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /var/lib/jenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True

COLLECTION VERSION
$ ansible-galaxy collection list ansible.posix

# /usr/lib/python3/dist-packages/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.3.0
CONFIGURATION
$ ansible-config dump --only-changed
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = yaml
OS / ENVIRONMENT

Ubuntu 20.04
ansible installed from ppa:ansible/ansible

$ dpkg -l | grep ansible
ii  ansible                            5.1.0-1ppa~focal                                                   all          batteries-included package providing a curated set of Ansible collections in addition to ansible-core
ii  ansible-core                       2.12.1-1ppa~focal                                                  all          Ansible IT Automation
STEPS TO REPRODUCE
- hosts: tag_Type_webserver
  become: yes
  vars:
    ansible_python_interpreter: '/usr/bin/python3'
    ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
  remote_user: jenkins
  tasks:
    - name: Transfer files to instances
      synchronize:
        src: "/tmp/dir with spaces"
        dest: "/var/www/webapp/releases/build-test/"
        links: yes
        perms: yes
        recursive: yes
        times: yes
        rsync_opts:
          - --chown=www-data:www-data
          - --exclude=.git
          - --exclude=node_modules
EXPECTED RESULTS

It works

ACTUAL RESULTS
$ ansible-playbook -i aws_ec2.yml test.yml

PLAY [tag_Type_webserver] *************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************************
ok: [ec2-3-122-238-188.eu-central-1.compute.amazonaws.com]

TASK [Transfer files to instances] ****************************************************************************************************************************************
fatal: [ec2-3-122-238-188.eu-central-1.compute.amazonaws.com]: FAILED! => changed=false 
  cmd: /usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --rsync-path='sudo -u root rsync' --chown=www-data:www-data --exclude=.git --exclude=node_modules --out-format='<<CHANGED>>%i %n%L' /tmp/dir with spaces [email protected]:/var/www/webapp/releases/build-test/
  msg: |-
    Warning: Permanently added 'ec2-3-122-238-188.eu-central-1.compute.amazonaws.com,3.122.238.188' (ECDSA) to the list of known hosts.
    rsync: link_stat "/tmp/dir" failed: No such file or directory (2)
    rsync: link_stat "/var/lib/jenkins/.local/ansible/searchie-dev-eu/with" failed: No such file or directory (2)
    rsync: link_stat "/var/lib/jenkins/.local/ansible/searchie-dev-eu/spaces" failed: No such file or directory (2)
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
  rc: 23

PLAY RECAP ****************************************************************************************************************************************************************
ec2-3-122-238-188.eu-central-1.compute.amazonaws.com : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

$ ls -la "/tmp/dir with spaces"
total 12
drwxrwxr-x  2 jenkins jenkins 4096 Dec 30 21:40 .
drwxrwxrwt 24 root    root    4096 Dec 30 21:39 ..
-rw-rw-r--  1 jenkins jenkins    5 Dec 30 21:40 test_file
@saito-hideki saito-hideki added the needs_triage Needs a first human triage before being processed. label Jan 7, 2022
@saito-hideki
Copy link
Collaborator

Hi @azhelev !
Thank you for reporting this. I have confirmed that the issue has been fixed by #278 in my test environment.
If it is possible, can you try to use devel version ansible.posix?

@saito-hideki saito-hideki added needs_info verified This issue has been verified/reproduced by maintainer has_pr and removed needs_triage Needs a first human triage before being processed. labels Feb 25, 2022
@azhelev
Copy link
Author

azhelev commented Mar 28, 2022

Hi,
sorry for late reply. I was able to test, works for me now.
Thanks

@db-it
Copy link

db-it commented Dec 22, 2023

Hi,
what's the status here? Is there a fix, that could be released?

Facing the same issue. :(

@saito-hideki saito-hideki added the synchronize Issue and PR for synchronize module label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr needs_info synchronize Issue and PR for synchronize module verified This issue has been verified/reproduced by maintainer
Projects
None yet
Development

No branches or pull requests

3 participants