Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

Core

ANSIBLE VERSION

ansible 2.4.0.0
config file = /Users/loranger/.ansible.cfg
configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

CONFIGURATION

DEFAULT_HOST_LIST(/Users/loranger/.ansible.cfg) = [u'/Users/loranger/.ansible/hosts']

DEFAULT_REMOTE_TMP(/Users/loranger/.ansible.cfg) = $HOME/.ansible/tmp

DEFAULT_ROLES_PATH(/Users/loranger/.ansible.cfg) = [u'/Users/loranger/.ansible/roles']

HOST_KEY_CHECKING(/Users/loranger/.ansible.cfg) = False

OS / ENVIRONMENT

Using Ansible on macOS 10.13 to various debians

SUMMARY

Since I enabled a Business Dropbox account, Dropbox app renamed the default Dropbox folder to Dropbox (Personnelle) and my sync-ed ansible folder (~/.ansible -> ~/Dropbox (Personnelle)/OSX/mackup/.ansible) now contains a space which ansible cannot deal with.

As discussed on the mailinglist, I cannot rename the Dropbox folder because the app detect the change and rollback my modifications.

It seems my bug could be fixed if ansible would surround the inventory folder by quotes, or escape pathes.

STEPS TO REPRODUCE

❯ ansible chaos -m ping

EXPECTED RESULTS

chaos | SUCCESS => {
"changed": false,
"ping": "pong"
}

ACTUAL RESULTS

ansible 2.4.0.0
config file = /Users/loranger/.ansible.cfg
configured module search path = [u'/Users/loranger/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.14 (default, Sep 25 2017, 09:54:19) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
Using /Users/loranger/.ansible.cfg as config file
setting up inventory plugins
Parsed /Users/loranger/.ansible/hosts/composer inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/dujour.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/hosts inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/northern.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/perso.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/phoenix.disable inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/puccia.conf inventory source with ini plugin
Parsed /Users/loranger/.ansible/hosts/raspberry.conf inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
META: ran handlers
Using module file /usr/local/Cellar/ansible/2.4.0.0/libexec/lib/python2.7/site-packages/ansible/modules/system/ping.py
<chaos> ESTABLISH SSH CONNECTION FOR USER: None
<chaos> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Users/loranger/Dropbox (Personnelle)/OSX/mackup/.ansible/cp/eead3d7599' chaos '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `" && echo ansible-tmp-1508359150.0-45696358822537="` echo $HOME/.ansible/tmp/ansible-tmp-1508359150.0-45696358822537 `" ) && sleep 0'"'"''
<chaos> (255, '', 'command-line line 0: garbage at end of line; "(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599".\r\n')
chaos | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \"(Personnelle)/OSX/mackup/.ansible/cp/eead3d7599\".\r\n",
"unreachable": true
}

(Sorry to re-open my previous issue, but it seems it's a real bug)

Issue 2:
SUMMARY

When for any reason the .ansible/ directory is inside a path with whitespaces, the 'control_path' generated by default is wrong, and thus the SSH commandline.

The addition of quotes surrounding the 'control_path' inside 'ansible/plugins/connection/ssh.py' fixes the bug.

ISSUE TYPE

Bug Report

COMPONENT NAME

Connection plugin

ANSIBLE VERSION

ansible 2.8.2
config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
python version = 3.7.3 (default, Jul 7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]

CONFIGURATION

DEFAULT_HOST_LIST(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = ['/Users/pposca/proyectos/kipeos-devops/hosts']
INTERPRETER_PYTHON(/Users/pposca/proyectos/kipeos-devops/ansible.cfg) = auto

OS / ENVIRONMENT

MacOS 10.14.5

Mackup (so .ansible/ is a symlink to a directory with whitespaces in its path)

Python 3.7.3

STEPS TO REPRODUCE

Having .ansible inside a directory with whitespaces in its path:

ansible all -m ping

EXPECTED RESULTS

mydomain.com | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}

ACTUAL RESULTS

ansible 2.8.2
config file = /Users/pposca/proyectos/kipeos-devops/ansible.cfg
configured module search path = ['/Users/pposca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible
executable location = /Users/pposca/.virtualenvs/kipeos-devops/bin/ansible
python version = 3.7.3 (default, Jul 7 2019, 18:15:21) [Clang 10.0.1 (clang-1001.0.46.4)]
Using /Users/pposca/proyectos/kipeos-devops/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
script declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
auto declined parsing /Users/pposca/proyectos/kipeos-devops/hosts as it did not pass it's verify_file() method
Parsed /Users/pposca/proyectos/kipeos-devops/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /Users/pposca/.virtualenvs/kipeos-devops/lib/python3.7/site-packages/ansible/plugins/callback/minimal.py
META: ran handlers
<mydomain.com> ESTABLISH SSH CONNECTION FOR USER: None
<mydomain.com> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756' mydomain.com '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<mydomain.com> (255, b'', b'command-line line 0: garbage at end of line; "HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756".\r\n')
mydomain.com | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: command-line line 0: garbage at end of line; \"HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756\".",
"unreachable": true
}

VALUE OF THE VARIABLE 'b_args'

Note the whitespace after 'Apple':

(b'-o', b'ControlPath=/Volumes/Apple HDD/VDrive/Dropbox/Mackup/.ansible/cp/fc95ded756')

RELATED ISSUES

#7713 #31916