Skip to content

Commit

Permalink
'or' logic doesn't allow 'None' which evaluates as False.
Browse files Browse the repository at this point in the history
This means that "allow_agent" cannot be set to True
based on the logic provided.

Instead, check if the value exists in the dict, then
set the value absolutely (even if it's "None") if set.
  • Loading branch information
jjico committed Nov 22, 2017
1 parent 2eaac6c commit 226ac24
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/jnpr/junos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,10 +1146,14 @@ def __init__(self, *vargs, **kvargs):
self._ssh_config = kvargs.get('ssh_config')
self._sshconf_lkup()
# but if user or private key is explicit from call, then use it.
self._auth_user = kvargs.get('user') or self._conf_auth_user or \
self._auth_user
self._ssh_private_key_file = kvargs.get('ssh_private_key_file') \
or self._conf_ssh_private_key_file
if 'user' in kvargs:
self._auth_user = kvargs.get('user')
else:
self._auth_user = self._conf_auth_user or self._auth_user
if 'ssh_private_key_file' in kvargs:
self._ssh_private_key_file = kvargs.get('ssh_private_key_file')
else:
self._ssh_private_key_file = self._conf_ssh_private_key_file
self._auth_password = kvargs.get(
'password') or kvargs.get('passwd')

Expand Down

0 comments on commit 226ac24

Please sign in to comment.