Ansible git/OSX: "connect() takes at most 3 arguments (7 given)"

I am trying to use ansible directly from a git checkout, on OSX 10.7.5 (which comes with python 2.7.1)

I get the following error:

$ git branch

  • devel
    master

$ cat test.inv
localhost

$ PYTHONPATH=lib bin/ansible localhost -i test.inv -m shell -a ‘echo hello’
localhost | FAILED => Traceback (most recent call last):
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 375, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 462, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 610, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
TypeError: connect() takes at most 3 arguments (7 given)

Adding -vvv doesn’t give any more info. I believe I have the correct dependencies, although they were installed a while ago and may not be the latest ones:

$ ls /Library/Python/2.7/site-packages/
Jinja2-2.6-py2.7.egg paramiko-1.7.7.2-py2.7.egg
PyYAML-3.10-py2.7-macosx-10.7-intel.egg pycrypto-2.6-py2.7-macosx-10.7-intel.egg
README vboxapi
easy-install.pth vboxapi-1.0-py2.7.egg-info

So then I updated to latest versions of paramiko/PyYAML/Jinja2:

$ ls /Library/Python/2.7/site-packages/
Jinja2-2.6-py2.7.egg paramiko-1.11.0-py2.7.egg
Jinja2-2.7.1-py2.7.egg paramiko-1.7.7.2-py2.7.egg
MarkupSafe-0.18-py2.7-macosx-10.7-intel.egg pycrypto-2.6-py2.7-macosx-10.7-intel.egg
PyYAML-3.10-py2.7-macosx-10.7-intel.egg vboxapi
README vboxapi-1.0-py2.7.egg-info
easy-install.pth

But unfortunately I get exactly the same result. Any clues?

Thanks,

Brian.

I found the documentation about hacking/env-setup, but this doesn’t make a difference. I also tried a “git checkout” of some previous tagged versions (e.g. v1.2) with no change. So there’s something really strange going on on my box, but I can’t see what it is.

Brians-MacBook-Air:ansible $ . hacking/env-setup

Setting up Ansible to run out of checkout…

PATH=/Users/brian/git/ansible/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin
PYTHONPATH=/Users/brian/git/ansible/lib:
ANSIBLE_LIBRARY=/Users/brian/git/ansible/library
MANPATH=/Users/brian/git/ansible/docs/man:

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

Done!

Brians-MacBook-Air:ansible $ ansible localhost -i test.inv -m shell -a 'echo hello’localhost | FAILED => Traceback (most recent call last):
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 375, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 462, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/Users/brian/git/ansible/lib/ansible/runner/init.py”, line 610, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
TypeError: connect() takes at most 3 arguments (7 given)

Brians-MacBook-Air:ansible $ which ansible
/Users/brian/git/ansible/bin/ansible

Solved. I believe the problem was probably the existence of an old init.pyc from a previous incarnation of ansible.

$ ls lib/ansible/runner/connection
init.pyc local.pyc paramiko_ssh.pyc ssh.pyc

Anyway, it was fixed by this:

$ find . -name ‘*.pyc’ | xargs rm

Yep.