From 5b4f3b1eda9ff5707fbbf8969bafb427f7755b09 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 30 Sep 2016 16:25:40 -0400 Subject: [PATCH] adds better error handling when conditional fails (#17839) When the conditional cannot extract a value from the result string, an unhandled exception would be raised. This fix now gracefully handles the exception --- lib/ansible/module_utils/netcli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/netcli.py b/lib/ansible/module_utils/netcli.py index 1e9ef007793..33b6d2d92bc 100644 --- a/lib/ansible/module_utils/netcli.py +++ b/lib/ansible/module_utils/netcli.py @@ -228,7 +228,7 @@ class Conditional(object): if self.encoding in ['json', 'text']: try: return self.get_json(result) - except (IndexError, TypeError): + except (IndexError, TypeError, AttributeError): msg = 'unable to apply conditional to result' raise FailedConditionalError(msg, self.raw)