minor bugfix that will catch connection errors in iosxr
This commit fixes a situation where connection errors would be caught but no useful information display. The connection error is now caught and emitted in a call to fail_json
This commit is contained in:
parent
5c7c13b9c1
commit
df3f9345e1
1 changed files with 6 additions and 1 deletions
|
@ -48,7 +48,12 @@ class Cli(object):
|
|||
password = self.module.params['password']
|
||||
|
||||
self.shell = Shell()
|
||||
self.shell.open(host, port=port, username=username, password=password)
|
||||
|
||||
try:
|
||||
self.shell.open(host, port=port, username=username, password=password)
|
||||
except Exception, exc:
|
||||
msg = 'failed to connecto to %s:%s - %s' % (host, port, str(exc))
|
||||
self.module.fail_json(msg=msg)
|
||||
|
||||
def send(self, commands):
|
||||
return self.shell.send(commands)
|
||||
|
|
Loading…
Reference in a new issue