From 06d02782902b8c006f1977bb8dafe6f9ffc859ce Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Thu, 23 Feb 2017 16:59:06 -0500 Subject: [PATCH] fix bug that would cause stack trace in nxos_nxapi (#21861) The parse_sandbox function will generate a stack trace if the command is not supported. This patch will resolve that issue. --- lib/ansible/modules/network/nxos/nxos_nxapi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/nxos/nxos_nxapi.py b/lib/ansible/modules/network/nxos/nxos_nxapi.py index b66d0b4f64..1088667248 100644 --- a/lib/ansible/modules/network/nxos/nxos_nxapi.py +++ b/lib/ansible/modules/network/nxos/nxos_nxapi.py @@ -205,7 +205,10 @@ def parse_https(data): def parse_sandbox(data): match = re.search('Sandbox:\s+(.+)$', data, re.M) - return {'sandbox': match.group(1) == 'Enabled'} + value = None + if match: + value = match.group(1) == 'Enabled' + return {'sandbox': value} def map_config_to_obj(module): out = run_commands(module, ['show nxapi'], check_rc=False)