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

Syncronize does not properly escape space characters #530

Open
kartikay101 opened this issue Jan 29, 2024 · 4 comments
Open

Syncronize does not properly escape space characters #530

kartikay101 opened this issue Jan 29, 2024 · 4 comments
Labels
synchronize Issue and PR for synchronize module

Comments

@kartikay101
Copy link

SUMMARY

Syncronize on a macbook does not escape spaces properly and causes the syncronize command to fail.

FAILED! => {
    "changed": false,
    "module_stderr": "/bin/sh: /Users/testing/Library/Application: No such file or directory\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 127
}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

syncronize.py

ANSIBLE VERSION
ansible [core 2.16.2]
  config file = None
  configured module search path = ['/Users/testing/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/testing/Library/Application Support/pipx/venvs/ansible/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/testing/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/testing/.local/bin/ansible
  python version = 3.12.1 (main, Dec  8 2023, 18:57:37) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/testing/Library/Application Support/pipx/venvs/ansible/bin/python)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
amazon.aws                    7.0.0
ansible.netcommon             5.3.0
ansible.posix                 1.5.4
ansible.utils                 2.12.0
ansible.windows               2.2.0
arista.eos                    6.2.2
awx.awx                       23.5.0
azure.azcollection            1.19.0
check_point.mgmt              5.1.1
chocolatey.chocolatey         1.5.1
cisco.aci                     2.8.0
cisco.asa                     4.0.3
cisco.dnac                    6.8.1
cisco.intersight              2.0.3
cisco.ios                     5.3.0
cisco.iosxr                   6.1.1
cisco.ise                     2.6.2
cisco.meraki                  2.16.16
cisco.mso                     2.5.0
cisco.nxos                    5.3.0
cisco.ucs                     1.10.0
cloud.common                  2.1.4
cloudscale_ch.cloud           2.3.1
community.aws                 7.0.0
community.azure               2.0.0
community.ciscosmb            1.0.7
community.crypto              2.16.1
community.digitalocean        1.24.0
community.dns                 2.6.4
community.docker              3.4.11
community.general             8.1.0
community.grafana             1.6.1
community.hashi_vault         6.0.0
community.hrobot              1.8.2
community.libvirt             1.3.0
community.mongodb             1.6.3
community.mysql               3.8.0
community.network             5.0.2
community.okd                 2.3.0
community.postgresql          3.2.0
community.proxysql            1.5.1
community.rabbitmq            1.2.3
community.routeros            2.11.0
community.sap                 2.0.0
community.sap_libs            1.4.1
community.sops                1.6.7
community.vmware              4.0.1
community.windows             2.1.0
community.zabbix              2.2.0
containers.podman             1.11.0
cyberark.conjur               1.2.2
cyberark.pas                  1.0.23
dellemc.enterprise_sonic      2.2.0
dellemc.openmanage            8.5.0
dellemc.powerflex             2.1.0
dellemc.unity                 1.7.1
f5networks.f5_modules         1.27.1
fortinet.fortimanager         2.3.0
fortinet.fortios              2.3.4
frr.frr                       2.0.2
gluster.gluster               1.0.2
google.cloud                  1.3.0
grafana.grafana               2.2.3
hetzner.hcloud                2.4.1
hpe.nimble                    1.1.4
ibm.qradar                    2.1.0
ibm.spectrum_virtualize       2.0.0
ibm.storage_virtualize        2.1.0
infinidat.infinibox           1.3.12
infoblox.nios_modules         1.5.0
inspur.ispim                  2.2.0
inspur.sm                     2.3.0
junipernetworks.junos         5.3.1
kubernetes.core               2.4.0
lowlydba.sqlserver            2.2.2
microsoft.ad                  1.4.1
netapp.aws                    21.7.1
netapp.azure                  21.10.1
netapp.cloudmanager           21.22.1
netapp.elementsw              21.7.0
netapp.ontap                  22.8.3
netapp.storagegrid            21.11.1
netapp.um_info                21.8.1
netapp_eseries.santricity     1.4.0
netbox.netbox                 3.15.0
ngine_io.cloudstack           2.3.0
ngine_io.exoscale             1.1.0
openstack.cloud               2.2.0
openvswitch.openvswitch       2.1.1
ovirt.ovirt                   3.2.0
purestorage.flasharray        1.24.0
purestorage.flashblade        1.14.0
purestorage.fusion            1.6.0
sensu.sensu_go                1.14.0
splunk.es                     2.1.2
t_systems_mms.icinga_director 2.0.1
telekom_mms.icinga_director   1.35.0
theforeman.foreman            3.15.0
vmware.vmware_rest            2.3.1
vultr.cloud                   1.10.1
vyos.vyos                     4.1.0
wti.remote                    1.0.5

CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

MacOS Ventura

STEPS TO REPRODUCE

run ansible-playbook playbook.yml -i inv.yml

- name: Copy image archive
  synchronize:
    src: "{{base_directory}}/files/{{ image_tar_source }}"
    dest: /tmp/image.tar
EXPECTED RESULTS

Copies the file over to the remote server from the source

ACTUAL RESULTS
EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq `"&& mkdir "` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724 `" && echo ansible-tmp-1706531947.075653-60922-147673873507724="` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724 `" ) && sleep 0'
Using module file /Users/testing/Library/Application Support/pipx/venvs/ansible/lib/python3.12/site-packages/ansible_collections/ansible/posix/plugins/modules/synchronize.py
<SOME_IP_ADDRESS> PUT /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/tmp14kxzaqh TO /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py
<SOME_IP_ADDRESS> EXEC /bin/sh -c 'chmod u+x /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/ /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py && sleep 0'
<SOME_IP_ADDRESS> EXEC /bin/sh -c '/Users/testing/Library/Application Support/pipx/venvs/ansible/bin/python /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py && sleep 0'
<SOME_IP_ADDRESS> EXEC /bin/sh -c 'rm -f -r /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/ > /dev/null 2>&1 && sleep 0'EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq `"&& mkdir "` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724 `" && echo ansible-tmp-1706531947.075653-60922-147673873507724="` echo /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724 `" ) && sleep 0'
Using module file /Users/testing/Library/Application Support/pipx/venvs/ansible/lib/python3.12/site-packages/ansible_collections/ansible/posix/plugins/modules/synchronize.py
<SOME_IP_ADDRESS> PUT /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/tmp14kxzaqh TO /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py
<SOME_IP_ADDRESS> EXEC /bin/sh -c 'chmod u+x /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/ /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py && sleep 0'
<SOME_IP_ADDRESS> EXEC /bin/sh -c '/Users/testing/Library/Application Support/pipx/venvs/ansible/bin/python /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/AnsiballZ_synchronize.py && sleep 0'
<SOME_IP_ADDRESS> EXEC /bin/sh -c 'rm -f -r /Users/testing/.ansible/tmp/ansible-local-60830k7c_n3wq/ansible-tmp-1706531947.075653-60922-147673873507724/ > /dev/null 2>&1 && sleep 0'
@kartikay101
Copy link
Author

I am willing to add a PR if this is considered a valid bug

@maxamillion
Copy link
Collaborator

@kartikay101 this looks valid to me, but I don't own a Mac and can't verify

@ksuehring
Copy link

I had the same issue after installing Ansible with pipx on macOS. Setting the environment variable PIPX_HOME to a path without spaces works as a work-around. The default in macOS is $HOME/Library/Application Support/pipx, which has the space in it.

@kartikay101
Copy link
Author

kartikay101 commented Feb 21, 2024

@maxamillion Thanks for confirming, can you point me to a general place to look at. I believe it should be a quick fix

@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
synchronize Issue and PR for synchronize module
Projects
None yet
Development

No branches or pull requests

4 participants