From 0d3c0515c0fa9a694f3ad631d1df1ace3ee789ee Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Wed, 17 Feb 2016 14:14:24 +0000 Subject: [PATCH] minor bugfix that will catch connection errors in ios 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 --- lib/ansible/module_utils/ios.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py index 3340213fa8..00d746f0e0 100644 --- a/lib/ansible/module_utils/ios.py +++ b/lib/ansible/module_utils/ios.py @@ -57,7 +57,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 authorize(self): passwd = self.module.params['auth_pass']