ansible.posix icon indicating copy to clipboard operation
ansible.posix copied to clipboard

Synchronize not using quotes around arguments like --out-format

Open PrestonTaylor opened this issue 4 years ago • 6 comments

SUMMARY

quotes not being places around important arguments See here for further details https://github.com/ansible/ansible/issues/46126 Confirmed still buggy in 2.9.6

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Synchronize

ANSIBLE VERSION
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/me/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
OS / ENVIRONMENT

Ubuntu 20 local Centos 7 remote

STEPS TO REPRODUCE
  - name: rsync
    synchronize:
      src: /home/centos/somedir/*
      dest: /app/somdir
      rsync_opts:
        - "--exclude='someotherdir'" 
      mode: pull
      compress: no
    delegate_to: "{{ inventory_hostname }}"

EXPECTED RESULTS
/usr/bin/rsync --delay-updates -F --archive --exclude='someotherdir' --out-format='<<CHANGED>>%i %n%L' /home/centos/somedir/* /app/somedir
ACTUAL RESULTS
"cmd": "/usr/bin/rsync --delay-updates -F --archive --exclude='someotherdir' --out-format=<<CHANGED>>%i %n%L /home/centos/somedir/* /app/somedir",

---snip---
"msg": "rsync: link_stat \"/home/centos/somedir/*\" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]\n",

Notice lack of ' on --out-format

PrestonTaylor avatar May 24 '21 18:05 PrestonTaylor

@PrestonTaylor Could you please check PR #213 works for you and let us know? Thanks.

needs_info

Akasurde avatar Jul 08 '21 12:07 Akasurde

Looks good to me, I'm having trouble using galaxy to install this branch to test it (if you have an command that would resolve that then I'll give it a try) but I can't see why this wouldn't resolve it.

preston@asdf~$ ansible-galaxy install -vvvv git+https://github.com/ansible-collections/ansible.posix.git,fix-24-and-190
ansible-galaxy 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/preston/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-galaxy
  python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
Processing role ansible.posix
[WARNING]: - ansible.posix was NOT installed successfully: - command /usr/bin/git checkout fix-24-and-190 failed in directory /home/preston/.ansible/tmp/ansible-
local-1258h4wz0_kg/tmppq2a0buw/ansible.posix (rc=1)
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.

PrestonTaylor avatar Jul 13 '21 22:07 PrestonTaylor

@PrestonTaylor Thanks for the feedback. The PR #213 is not merged, yet. So you need to use origin authors repo like -

# ansible-galaxy collection install git+https://github.com/ndgit/ansible.posix.git,fix-24-and-190

Let me know if you require any help.

Akasurde avatar Jul 14 '21 08:07 Akasurde

In my opinion, this is not a bug.

I can reproduce the issue with a glob pattern as the src, like in the description (src: /home/centos/somedir/*). But there is nothing that claims that glob patterns are supported for src parameter, as results tell us:

rsync: link_stat "/home/centos/somedir/*" failed: No such file or directory

@PrestonTaylor , a trailing / in your src path could be what you need to reach your goal. Please refer to the rsync(1) manpage for clarifications about /path/to/source vs. /path/to/source/ behaviors.

quidame avatar Jul 26 '21 03:07 quidame