From 91f3558c64e64c56ac37f284ae3fc0ab7e261cc5 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Wed, 17 Feb 2016 14:12:50 +0000 Subject: [PATCH] minor bugfix that will catch connection errors in eos 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/eos.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/eos.py b/lib/ansible/module_utils/eos.py index 5e0dfefc35..71fa8802b6 100644 --- a/lib/ansible/module_utils/eos.py +++ b/lib/ansible/module_utils/eos.py @@ -127,7 +127,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']