Skip to content
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
Closed

invoke_shell() broke in Paramiko 2.1. #859

ebeahan opened this issue Dec 9, 2016 · 13 comments

Comments

@ebeahan
Copy link

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 Call to update_environment_variables fails in 2.1 invoke_shell() broke in Paramiko 2.1. Dec 9, 2016
@ktbyers
Copy link
Contributor

ktbyers commented Dec 9, 2016

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

@ktbyers
Copy link
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
Copy link

sanseihappa commented Dec 9, 2016

Seeing the same issue also. Also seeing with 2.0.3.

@ktbyers
Copy link
Contributor

ktbyers commented Dec 10, 2016

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

@ktbyers
Copy link
Contributor

ktbyers commented Dec 10, 2016

This also will break some Ansible networking modules.

@raphaelcastaneda
Copy link

This also breaks robotframework/SSHLibrary

@warp1337
Copy link

In what version was this still working?

@ebeahan
Copy link
Author

ebeahan commented Dec 10, 2016

2.0.2

@ktbyers
Copy link
Contributor

ktbyers commented Dec 10, 2016

@bitprophet
Copy link
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
Copy link
Member

OK...

Will release soon.

bitprophet added a commit that referenced this issue Dec 12, 2016
@bitprophet
Copy link
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!

@ktbyers
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants