Skip to content

Commit

Permalink
start_shell: initialize SSH client the same way as for SCP
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat committed Jan 13, 2017
1 parent 63ccdcc commit 35d3390
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/jnpr/junos/utils/start_shell.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import paramiko
from select import select
import re
import datetime

from jnpr.junos.utils.misc import get_ssh_client

_JUNOS_PROMPT = '> '
_SHELL_PROMPT = '(%|#)\s'
_SELECT_WAIT = 0.1
Expand Down Expand Up @@ -82,16 +83,7 @@ def open(self):
:class:`paramiko.SSHClient` instance.
"""
junos = self._nc

client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=junos.hostname,
port=(22, junos._port)[junos.hostname == 'localhost'],
username=junos._auth_user,
password=junos._auth_password,
)

client = get_ssh_client(junos)
chan = client.invoke_shell()
self._client = client
self._chan = chan
Expand Down

0 comments on commit 35d3390

Please sign in to comment.