"'Connection' object has no attribute 'shell'" when attempting to establish an accelerated connection

I received the below error when trying to run a playbook.

I’m running your latest dev Ansible pulled from github (1.7).

I’m new to Ansible and am setting it up on my PC for the first time, although we have it running elsewhere in our organization and am playing with their existing playbooks.

Here’s the change (hack) I put in your code to work around the issue:

`

diff ./build/lib.linux-x86_64-2.7/ansible/runner/connection_plugins/accelerate.py /usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/accelerate.py
103a104,105
if not getattr(self.ssh, ‘shell’, None):
self.ssh.shell = utils.plugins.shell_loader.get(‘sh’)

`

It’s probably not the best solution to the problem, but FYI.

thanks,
David

`

ansible-playbook reports.yml -vvvv --check --user=root --connection=ssh

PLAY [lab2] *******************************************************************

GATHERING FACTS ***************************************************************
attempting connection to 172.16.8.191 via the accelerated port 5099
connection to 172.16.8.191 failed, retrying…
connection to 172.16.8.191 failed, retrying…
connection to 172.16.8.191 failed, retrying…
Could not connect via the accelerated connection, exceeded # of tries
Falling back to ssh to startup accelerated mode
attempting to start up the accelerate daemon…
<172.16.8.191> ESTABLISH CONNECTION FOR USER: root
fatal: [172.16.8.191] => Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 528, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 630, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 801, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection.py”, line 34, in connect
self.active = conn.connect()
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/accelerate.py”, line 146, in connect
res = self._execute_accelerate_module()
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/accelerate.py”, line 104, in _execute_accelerate_module
tmp_path = self.runner._make_tmp_path(self.ssh)
File “/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/init.py”, line 1036, in _make_tmp_path
cmd = conn.shell.mkdtemp(basefile, use_system_tmp, tmp_mode)
AttributeError: ‘Connection’ object has no attribute ‘shell’

`

Seeing this same issue. Is there a better fix?

Haven’t heard any reports of this - apologies on not having a reply to the July 15th thread, must have missed it.

Can you please share what you do on a clean VM to replicate the issue and the output of ‘ansible --version’ ?

I am hoping “PC” does not mean Windows host, as we definitely only support managing Windows nodes, not running Ansible from Windows pythons.

Hi,

I’ve just encountered the same issue. Ansible 1.7.1 from Debian Testing Repository. OP proposed fix helps.

I can reproduce it with this playbook:

  • hosts: testsetup
    accelerate: yes
    accelerate_port: 4711
    tasks:
  • command: /bin/ls

Cya, Ed

Ok, I’ll file a bug on this now so it can be fixed for later.

Thanks!

This was addressed on the devel branch today, and will be a part of a future 1.7.2 update which we’ll do soon.

Thanks!