From 9eff1f1d74f20b31b69ecb3d9aa7278626562725 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Fri, 4 May 2018 12:21:58 +0530 Subject: [PATCH] Handle nxos_feature issue where json isn't supported (#39150) Signed-off-by: Trishna Guha --- lib/ansible/modules/network/nxos/nxos_feature.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_feature.py b/lib/ansible/modules/network/nxos/nxos_feature.py index e5fc994fc0..d355e908f7 100644 --- a/lib/ansible/modules/network/nxos/nxos_feature.py +++ b/lib/ansible/modules/network/nxos/nxos_feature.py @@ -72,6 +72,7 @@ commands: import re from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import ConnectionError from ansible.module_utils.network.nxos.nxos import load_config, run_commands from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec @@ -130,8 +131,13 @@ def validate_feature(module, mode='show'): how they are configured''' feature = module.params['feature'] - info = get_capabilities(module).get('device_info', {}) - os_version = info.get('network_os_version', '') + + try: + info = get_capabilities(module) + device_info = info.get('device_info', {}) + os_version = device_info.get('network_os_version', '') + except ConnectionError: + os_version = '' if '8.1' in os_version: feature_to_be_mapped = {