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

**URL:** <https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679>\
**Category:** Ansible Project\
**Created:** [July 15, 2014, 2:54pm UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679 "2014-07-15T14:54:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Karnowski](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@David\_Karnowski](https://forum.ansible.com/u/David_Karnowski)\
**Post date:** [July 15, 2014, 2:54pm UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/1 "2014-07-15T14:54:38Z")

</div>

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’

`

---

<div class="post-metadata">

**Author:** ![Bryan\_Beaudreault](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@Bryan\_Beaudreault](https://forum.ansible.com/u/Bryan_Beaudreault)\
**Post date:** [August 26, 2014, 11:05pm UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/2 "2014-08-26T23:05:59Z")

</div>

Seeing this same issue. Is there a better fix?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 26, 2014, 11:17pm UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/3 "2014-08-26T23:17:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ed\_Hein](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Ed\_Hein](https://forum.ansible.com/u/Ed_Hein)\
**Post date:** [August 28, 2014, 7:52am UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/4 "2014-08-28T07:52:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 28, 2014, 11:59am UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/5 "2014-08-28T11:59:03Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 28, 2014, 9:03pm UTC](https://forum.ansible.com/t/connection-object-has-no-attribute-shell-when-attempting-to-establish-an-accelerated-connection/15679/6 "2014-08-28T21:03:49Z")

</div>

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!
