Juniper / py-junos-eznc

Python library for Junos automation
https://www.juniper.net/documentation/en_US/junos-pyez/information-products/pathway-pages/junos-pyez-developer-guide.html
Apache License 2.0
666 stars 341 forks source link

Juniper on-box script : StartShelll - credentials error #908

Open brahmastra2016 opened 5 years ago

brahmastra2016 commented 5 years ago

For on-box pyhton script we just use "dev = dev = Device()" to connect but it throw exception error since start shell module has the user/password as required parameters.

root@Nemo> op test.py

Traceback (most recent call last): File "/var/db/scripts/op/test.py", line 104, in main() File "/var/db/scripts/op/test.py", line 78, in main with StartShell(dev) as ss: File "../../../../../../../../src/dist/python-add-ons/junos-eznc/lib/jnpr/junos/utils/start_shell.py", line 170, in enter File "../../../../../../../../src/dist/python-add-ons/junos-eznc/lib/jnpr/junos/utils/start_shell.py", line 102, in open RuntimeError : StartShell requires user credentials

error: op script failed: /var/db/scripts/op/test.py

dineshbaburam91 commented 5 years ago

@brahmastra2016 For now start shell takes user credentials to make ssh connection. We need to extend this Class for on-box support (so that user dont need to pass credentials).

User can use subprocess functions to achieve what he intend to do using StartShell.