|
|
|
|
@ -77,9 +77,14 @@ class Cli(object):
|
|
|
|
|
key_filename = self.module.params['ssh_keyfile']
|
|
|
|
|
timeout = self.module.params['timeout']
|
|
|
|
|
|
|
|
|
|
allow_agent = (key_filename is not None) or (key_filename is None and password is None)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
self.shell = Shell(kickstart=False, prompts_re=CLI_PROMPTS_RE, errors_re=CLI_ERRORS_RE)
|
|
|
|
|
self.shell.open(host, port=port, username=username, password=password, key_filename=key_filename, timeout=timeout)
|
|
|
|
|
self.shell = Shell(kickstart=False, prompts_re=CLI_PROMPTS_RE,
|
|
|
|
|
errors_re=CLI_ERRORS_RE)
|
|
|
|
|
self.shell.open(host, port=port, username=username,
|
|
|
|
|
password=password, key_filename=key_filename,
|
|
|
|
|
allow_agent=allow_agent, timeout=timeout)
|
|
|
|
|
except ShellError:
|
|
|
|
|
e = get_exception()
|
|
|
|
|
msg = 'failed to connect to %s:%s - %s' % (host, port, str(e))
|
|
|
|
|
|