mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 12:58:36 +00:00
TelnetConnection:
- Allowed telnet connections without a password. This is required as part of the upcoming Gem5Device, which uses a password-less telnet connection to communicate with the device.
This commit is contained in:
parent
661371f6f0
commit
a6382b730b
@ -62,15 +62,20 @@ class TelnetConnection(pxssh.pxssh):
|
|||||||
cmd = 'telnet -l {} {} {}'.format(username, server, port)
|
cmd = 'telnet -l {} {} {}'.format(username, server, port)
|
||||||
|
|
||||||
spawn._spawn(self, cmd) # pylint: disable=protected-access
|
spawn._spawn(self, cmd) # pylint: disable=protected-access
|
||||||
i = self.expect('(?i)(?:password)', timeout=login_timeout)
|
try:
|
||||||
if i == 0:
|
i = self.expect('(?i)(?:password)', timeout=login_timeout)
|
||||||
self.sendline(password)
|
if i == 0:
|
||||||
i = self.expect([original_prompt, 'Login incorrect'], timeout=login_timeout)
|
self.sendline(password)
|
||||||
else:
|
i = self.expect([original_prompt, 'Login incorrect'], timeout=login_timeout)
|
||||||
raise pxssh.ExceptionPxssh('could not log in: did not see a password prompt')
|
if i:
|
||||||
|
raise pxssh.ExceptionPxssh('could not log in: password was incorrect')
|
||||||
if i:
|
except TIMEOUT:
|
||||||
raise pxssh.ExceptionPxssh('could not log in: password was incorrect')
|
if not password:
|
||||||
|
# There was no password prompt before TIMEOUT, and we didn't
|
||||||
|
# have a password to enter. Assume everything is OK.
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise pxssh.ExceptionPxssh('could not log in: did not see a password prompt')
|
||||||
|
|
||||||
if not self.sync_original_prompt(sync_multiplier):
|
if not self.sync_original_prompt(sync_multiplier):
|
||||||
self.close()
|
self.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user