mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
minor bugfix that will catch connection errors in nxos
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
58a6cf822a
commit
9e31e33850
1 changed files with 3 additions and 2 deletions
|
@ -147,7 +147,8 @@ class Cli(object):
|
|||
try:
|
||||
self.shell.open(host, port=port, username=username, password=password)
|
||||
except Exception, exc:
|
||||
self.module.fail_json('Failed to connect to {0}:{1} - {2}'.format(host, port, str(exc)))
|
||||
msg = 'failed to connecto to %s:%s - %s' % (host, port, str(exc))
|
||||
self.module.fail_json(msg=msg)
|
||||
|
||||
def send(self, commands, encoding='text'):
|
||||
return self.shell.send(commands)
|
||||
|
@ -188,7 +189,7 @@ class NetworkModule(AnsibleModule):
|
|||
def configure(self, commands):
|
||||
commands = to_list(commands)
|
||||
if self.params['transport'] == 'cli':
|
||||
commands.insert(0, 'configure terminal')
|
||||
commands.insert(0, 'configure')
|
||||
responses = self.execute(commands)
|
||||
responses.pop(0)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue