fix nxos_config json pipeline error (#36236)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-02-19 10:11:43 +05:30 committed by GitHub
parent a5654bd63c
commit 736d6406c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,9 +113,9 @@ options:
the modified lines are pushed to the device in configuration
mode. If the replace argument is set to I(block) then the entire
command block is pushed to the device in configuration mode if any
line is not correct. I(replace config) is supported on Nexus 9K device.
line is not correct. I(replace config) is supported only on Nexus 9K device.
required: false
default: lineo
default: line
choices: ['line', 'block', 'config']
force:
description:
@ -290,6 +290,7 @@ backup_path:
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import ConnectionError
from ansible.module_utils.network.common.config import NetworkConfig, dumps
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
from ansible.module_utils.network.nxos.nxos import get_capabilities
@ -390,12 +391,18 @@ def main():
config = None
info = get_capabilities(module).get('device_info', {})
os_platform = info.get('network_os_platform', '')
try:
info = get_capabilities(module)
api = info.get('network_api', 'nxapi')
device_info = info.get('device_info', {})
os_platform = device_info.get('network_os_platform', '')
except ConnectionError:
api = ''
os_platform = ''
if module.params['replace'] == 'config':
if api == 'cliconf' and module.params['replace'] == 'config':
if '9K' not in os_platform:
module.fail_json(msg='replace: config is supported only for Nexus 9K series switches')
module.fail_json(msg='replace: config is supported only on Nexus 9K series switches')
if module.params['replace_src']:
if module.params['replace'] != 'config':