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

Address issue #400 #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Address issue #400 #401

wants to merge 1 commit into from

Conversation

ddivins
Copy link
Contributor

@ddivins ddivins commented Jun 9, 2022

Issue #400 fix, line 669 remove "and action None" from else statement to allow password prompt to appear
Note, I do not know if this has implications outside my scenarios but all my tests are now working as expected

What does this PR do?

jsnapy with no username/password (where it should be prompted) dies after username

What issues does this PR fix or reference?

#400

Previous Behavior

ddivins@ddivins-mbp jsnap % jsnapy --snap pre -f config_check.yml -v
jsnapy.cfg file location used : /Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/etc/jsnapy
Configuration file location used : /etc/jsnapy
Connecting to device 172.25.92.59 ................

Enter User name: lab

ERROR occurred ConnectAuthError(172.25.92.59)
Exception in thread Thread-1 (connect):
Traceback (most recent call last):
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/jnpr/junos/device.py", line 1347, in open
    self._conn = netconf_ssh.connect(
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/ncclient/manager.py", line 168, in connect
    return connect_ssh(*args, **kwds)
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/ncclient/manager.py", line 135, in connect_ssh
    session.connect(*args, **kwds)
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/ncclient/transport/ssh.py", line 362, in connect
    self._auth(username, password, key_filenames, allow_agent, look_for_keys)
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/ncclient/transport/ssh.py", line 466, in _auth
    raise AuthenticationError("No authentication methods available")
ncclient.transport.errors.AuthenticationError: No authentication methods available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/jnpr/jsnapy/jsnapy.py", line 667, in connect
    dev.open()
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/jnpr/junos/device.py", line 1366, in open
    raise EzErrors.ConnectAuthError(self)
jnpr.junos.exception.ConnectAuthError: ConnectAuthError(172.25.92.59)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/lib/python3.10/site-packages/jnpr/jsnapy/jsnapy.py", line 689, in connect
    raise Exception(ex)
Exception: ConnectAuthError(172.25.92.59)

New Behavior

ddivins@ddivins-mbp jsnap % jsnapy --snap pre -f config_check.yml -v
jsnapy.cfg file location used : /Users/ddivins/Library/CloudStorage/OneDrive-JuniperNetworks,Inc/Documents/PycharmProjects/jsnap/venv/etc/jsnapy
Configuration file location used : /etc/jsnapy
Connecting to device 172.25.92.59 ................

Enter User name: lab

Enter Password for username <lab> : 
Connecting to device 172.25.92.59 ................
Tests Included : test_ntp_source 
Taking snapshot of RPC: get-config
Tests Included: test_ntp_status 
Taking snapshot of COMMAND: show ntp status 
Tests Included: test_ntp_association 
Taking snapshot of COMMAND: show ntp association 

Tests written?

Above was my test as well as using -l and -u from command and that still works

Issue Juniper#400 fix, line 669 remove "and action None" from else statement to allow password prompt to appear
Note, I do not know if this has implications outside my scenarios but all my tests are working as expected
@ydnath ydnath requested a review from dineshbaburam91 June 9, 2022 07:02
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

Successfully merging this pull request may close these issues.

1 participant