Check for ConnectionError on change of config or commands (#41504)

This commit is contained in:
Nathaniel Case 2018-06-14 09:45:54 -04:00 committed by GitHub
parent 5814b90835
commit 50e776877d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 14 deletions

View file

@ -147,7 +147,11 @@ class Cli:
"""Run list of commands on remote device and return results
"""
connection = self._get_connection()
return connection.run_commands(commands, check_rc)
try:
return connection.run_commands(commands, check_rc)
except ConnectionError as exc:
self._module.fail_json(msg=to_text(exc))
def load_config(self, config, return_error=False, opts=None):
"""Sends configuration commands to the remote device