Skip to content

Commit

Permalink
Re-added proper logic for allow_agent
Browse files Browse the repository at this point in the history
  • Loading branch information
shermdog committed Jul 17, 2014
1 parent 9ccc274 commit 7abe593
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/jnpr/junos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ def open(self, *vargs, **kvargs):
try:
ts_start = datetime.datetime.now()

# we want to enable the ssh-agent if-and-only-if we are
# not given a password or an ssh key file.
# in this condition it means we want to query the agent
# for available ssh keys

allow_agent = bool((self._auth_password is None) and
(self._ssh_private_key_file is None))

# open connection using ncclient transport
self._conn = netconf_ssh.connect(
host=self._hostname,
Expand All @@ -380,6 +388,7 @@ def open(self, *vargs, **kvargs):
password=self._auth_password,
hostkey_verify=False,
key_filename=self._ssh_private_key_file,
allow_agent=allow_agent,
device_params={'name': 'junos'})

except NcErrors.AuthenticationError as err:
Expand Down

0 comments on commit 7abe593

Please sign in to comment.