Updated ansible to track latest, now I have error 'Connection' object has no attribute '_split_ssh_args'

I just git pulled the latest build from GitHub, and then ran the following two commands as recommended on the Installation page:

$ git pull --rebase
$ git submodule update --init --recursive

However, I am now getting an exception that the 'Connection' object has no attribute '_split_ssh_args' on my target hosts. 
I must have missed something. My control host is running CentOS 7.1. What should I do to fix this?

Here is a verbose output:

<192.168.1.12> ESTABLISH SSH CONNECTION FOR USER: ansible

...nothing from that IP for several lines while other machines' output is recorded, then...

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/executor/process/worker.py", line 114, in run
    self._shared_loader_obj,
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/executor/task_executor.py", line 119, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/executor/task_executor.py", line 402, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/user/ansible/lib/ansible/plugins/action/normal.py", line 33, in run
    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/plugins/action/__init__.py", line 390, in _execute_module
    tmp = self._make_tmp_path()
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/plugins/action/__init__.py", line 205, in _make_tmp_path
    result = self._low_level_execute_command(cmd, sudoable=False)
  File "/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg/ansible/plugins/action/__init__.py", line 502, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/home/ansible/ansible/lib/ansible/plugins/connection/ssh.py", line 590, in exec_command
    return_tuple = self._exec_command(*args, **kwargs)
  File "/home/ansible/ansible/lib/ansible/plugins/connection/ssh.py", line 565, in _exec_command
    cmd = self._build_command('ssh', '-tt', self.host, cmd)
  File "/home/ansible/ansible/lib/ansible/plugins/connection/ssh.py", line 151, in _build_command
    args = self._split_ssh_args(self._play_context.ssh_args)
AttributeError: 'Connection' object has no attribute '_split_ssh_args'
fatal: [192.168.1.12]: FAILED! => {"failed": true, "stdout": ""}

Not seen this myself but a couple of things to investigate.

You don’t mention which version of ansible you were running previously - if it wasn’t from a development checkout, ensure you have run

source hacking/env-setup

Probably worth re-running even if you were on a dev checkout before.

Also the ‘ssh’, ‘-tt’ part of the stack trace reminded me of this comment I noticed on a closed issue from a few days ago:

https://github.com/ansible/ansible/issues/13876#issuecomment-186709690

Doesn’t sound like exactly the same issue but perhaps worth a look.

Hope this helps,

Jon

Hi Jon,

Thanks for the advice. I tried running that command, followed by the submodule commands, and still got the same playbook error.

Then, I rm -rf’d my ansible install directory, cloned the current github again, and ran the source hacking/env-setup command again.

Still no dice.

Every host fails in every playbook I have tried, with the same error "AttributeError: ‘Connection’ object has no attribute ‘_split_ssh_args’ "
Single-host playbooks fail with the same error.

Could this be caused by custom plugin paths pointing to where ansible is installed?

set plugin path directories here, separate with colons

action_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/action
callback_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/callback
connection_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/connection
lookup_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/lookup
vars_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/vars
filter_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/filter
test_plugins = /home/ansibleuser/ansible/lib/ansible/plugins/test

There was a change to the ConnectionBase and the ssh connection plugin, to move some useful methods onto the base class instead of being part of the ssh Connection class. Part of that was renaming _split_args to _split_ssh_args and moving it to ConnectionBase.

If this is failing, it seems that you may have a partially updated version of ansible.

Hi Matt,

I did an rm -rf of my ansible installation and re-cloned it from github right before reproducing this issue. What would be outside the ansible installation directory?

By the way, here is the output I see when I run source hacking/env-setup. Are the “no previously-included directories found” statements errors, or just informational?

$ source hacking/env-setup
running egg_info
creating lib/ansible.egg-info
writing requirements to lib/ansible.egg-info/requires.txt
writing lib/ansible.egg-info/PKG-INFO
writing top-level names to lib/ansible.egg-info/top_level.txt
writing dependency_links to lib/ansible.egg-info/dependency_links.txt
writing manifest file ‘lib/ansible.egg-info/SOURCES.txt’
reading manifest file ‘lib/ansible.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
no previously-included directories found matching ‘v2’
no previously-included directories found matching ‘docsite’
no previously-included directories found matching ‘ticket_stubs’
no previously-included directories found matching ‘packaging’
no previously-included directories found matching ‘test’
no previously-included directories found matching ‘hacking’
no previously-included directories found matching ‘lib/ansible/modules/core/.git’
no previously-included directories found matching ‘lib/ansible/modules/extras/.git’
writing manifest file ‘lib/ansible.egg-info/SOURCES.txt’

Setting up Ansible to run out of checkout…

PATH=/home/ansible-user/ansible/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ansible-user/.local/bin:/home/ansible-user/bin
PYTHONPATH=/home/ansible-user/ansible/lib:
MANPATH=/home/ansible-user/ansible/docs/man:

Remember, you may wish to specify your host file with -i

Done!

Okay, so apparently that output is okay.

The problem is that my system had another installation of Ansible on it. I asked pip to uninstall it for me, and now Ansible playbooks and ad-hoc commands are working again.