New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoke_shell() broke in Paramiko 2.1. #859

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

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

This comment has been minimized.

Show comment
Hide comment
@ktbyers

ktbyers Dec 9, 2016

Contributor

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

Contributor

ktbyers commented Dec 9, 2016

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

@ktbyers

This comment has been minimized.

Show comment
Hide comment
@ktbyers

ktbyers Dec 9, 2016

Contributor

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)
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

This comment has been minimized.

Show comment
Hide comment
@sanseihappa

sanseihappa Dec 9, 2016

Contributor

Seeing the same issue also. Also seeing with 2.0.3.

Contributor

sanseihappa commented Dec 9, 2016

Seeing the same issue also. Also seeing with 2.0.3.

@ktbyers

This comment has been minimized.

Show comment
Hide comment
@ktbyers

ktbyers Dec 10, 2016

Contributor

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

Contributor

ktbyers commented Dec 10, 2016

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

@ktbyers

This comment has been minimized.

Show comment
Hide comment
@ktbyers

ktbyers Dec 10, 2016

Contributor

This also will break some Ansible networking modules.

Contributor

ktbyers commented Dec 10, 2016

This also will break some Ansible networking modules.

@raphaelcastaneda

This comment has been minimized.

Show comment
Hide comment
@raphaelcastaneda

raphaelcastaneda Dec 10, 2016

This also breaks robotframework/SSHLibrary

raphaelcastaneda commented Dec 10, 2016

This also breaks robotframework/SSHLibrary

@warp1337

This comment has been minimized.

Show comment
Hide comment
@warp1337

warp1337 Dec 10, 2016

In what version was this still working?

warp1337 commented Dec 10, 2016

In what version was this still working?

@ebeahan

This comment has been minimized.

Show comment
Hide comment
@ebeahan

ebeahan commented Dec 10, 2016

2.0.2

@ktbyers

This comment has been minimized.

Show comment
Hide comment
@ktbyers
Contributor

ktbyers commented Dec 10, 2016

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Dec 12, 2016

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.)

Member

bitprophet commented Dec 12, 2016

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

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Dec 12, 2016

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.

Member

bitprophet commented Dec 12, 2016

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 added a commit that referenced this issue Dec 12, 2016

@bitprophet

This comment has been minimized.

Show comment
Hide comment
@bitprophet

bitprophet Dec 13, 2016

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!

Member

bitprophet commented Dec 13, 2016

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

This comment has been minimized.

Show comment
Hide comment
@ktbyers

ktbyers Dec 13, 2016

Contributor

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

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