invoke_shell() broke in Paramiko 2.1. #859

Closed
ebeahan opened this Issue Dec 9, 2016 · 13 comments

Projects

None yet

6 participants

@ebeahan
ebeahan commented Dec 9, 2016

The update_environment_variables method of Channel was updated to update_environment as per:

cfa81eb

The SSHClient class still contains a call to update_environment_variables which fails as of 2.1:

https://github.com/paramiko/paramiko/blob/2.1/paramiko/client.py#L467

@ebeahan ebeahan changed the title from Call to update_environment_variables fails in 2.1 to invoke_shell() broke in Paramiko 2.1. Dec 9, 2016
@ktbyers
Contributor
ktbyers commented Dec 9, 2016

This breaks the Netmiko library as invoke_shell() is used by almost all the Netmiko drivers.

@ktbyers
Contributor
ktbyers commented Dec 9, 2016

Here is an example on a new virtual environment:

$ python test_cisco.py 
Password: 
Traceback (most recent call last):
  File "test_cisco.py", line 31, in <module>
    with ConnectHandler(**device) as net_connect:
  File "/home/gituser/VENV/paramiko_test/local/lib/python2.7/site-packages/netmiko/ssh_dispatcher.py", line 96, in ConnectHandler
    return ConnectionClass(*args, **kwargs)
  File "/home/gituser/VENV/paramiko_test/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 89, in __init__
    self.establish_connection()
  File "/home/gituser/VENV/paramiko_test/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 411, in establish_connection
    self.remote_conn = self.remote_conn_pre.invoke_shell()
  File "/home/gituser/VENV/paramiko_test/local/lib/python2.7/site-packages/paramiko/client.py", line 467, in invoke_shell
    chan.update_environment_variables(environment or {})
AttributeError: 'Channel' object has no attribute 'update_environment_variables'

$ pip list
You are using pip version 7.0.3, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
cffi (1.9.1)
cryptography (1.6)
enum34 (1.1.6)
idna (2.1)
ipaddress (1.0.17)
netmiko (1.1.0)
paramiko (2.1.0)
pip (7.0.3)
pyasn1 (0.1.9)
pycparser (2.17)
PyYAML (3.12)
scp (0.10.2)
setuptools (17.0)
six (1.10.0)
wheel (0.24.0)
@sanseihappa
Contributor
sanseihappa commented Dec 9, 2016 edited

Seeing the same issue also. Also seeing with 2.0.3.

@ktbyers
Contributor
ktbyers commented Dec 10, 2016

@sanseihappa Okay, that makes sense change was applied to other releases also.

@ktbyers
Contributor
ktbyers commented Dec 10, 2016

This also will break some Ansible networking modules.

@raphaelcastaneda raphaelcastaneda referenced this issue in robotframework/SSHLibrary Dec 10, 2016
Merged

Support paramiko 2.1.0 transport signature #159

@raphaelcastaneda

This also breaks robotframework/SSHLibrary

@raphaelcastaneda raphaelcastaneda referenced this issue in robotframework/SSHLibrary Dec 10, 2016
Closed

New paramiko version causes connection failures #157

@warp1337

In what version was this still working?

@ebeahan
ebeahan commented Dec 10, 2016

2.0.2

@sigmaris sigmaris added a commit to sigmaris/paramiko that referenced this issue Dec 12, 2016
@sigmaris sigmaris fix unrelated issue #859 ad36e75
@bitprophet
Member

Hmmm I don't think this should have appeared in 2.0.3, I probably screwed up my branch merging. (Maintaining feature-vs-bugfix branches on both sides of a major version upgrade is new to me.)

@bitprophet
Member

OK...

  • Confirmed bug in 1.18.0, 2.0.3 (sigh) and 2.1.0
  • Cherry-picked #860 back to 1.18.0 and merged it up thru master
  • Confirmed fix on all versions
  • Reverted all feature work (sourced from 1.18's branch) in the 2.0 branch
  • Confirmed 2.0 still generally appears happy

Will release soon.

@bitprophet bitprophet added a commit that referenced this issue Dec 12, 2016
@bitprophet bitprophet Changelog re #859, re #860 3d913a9
@bitprophet
Member

OK, 1.18.1, 2.0.4 and 2.1.0 are all out and should have this fixed. Thanks to all who reported & to ktbyers for spotting the patch!

@bitprophet bitprophet closed this Dec 13, 2016
@ktbyers
Contributor
ktbyers commented Dec 13, 2016

FYI, I tested 1.18.1, 2.0.4, and 2.1.1 on Netmiko and they all work fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment