diff options
author | GGabriele <gabrielegerbino@gmail.com> | 2017-02-09 08:15:54 +0100 |
---|---|---|
committer | Nathaniel Case <Qalthos@gmail.com> | 2017-02-15 15:49:33 -0500 |
commit | efd1ae6e1390754e0b1d600780493bb010a6639b (patch) | |
tree | ca0e8b0a00d535a681bdacb73a6417948f51f055 | |
parent | 757629070702da3ab3527c0fa4efa322fbbf23a4 (diff) | |
download | ansible-modules-core-efd1ae6e1390754e0b1d600780493bb010a6639b.tar.gz |
Fixing nxos_feature when transport is cli
-rw-r--r-- | network/nxos/nxos_feature.py | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/network/nxos/nxos_feature.py b/network/nxos/nxos_feature.py index df078fce..5e3dcf3b 100644 --- a/network/nxos/nxos_feature.py +++ b/network/nxos/nxos_feature.py @@ -256,24 +256,6 @@ def execute_config_command(commands, module): error=str(clie), commands=commands) -def get_cli_body_ssh(command, response, module): - """Get response for when transport=cli. This is kind of a hack and mainly - needed because these modules were originally written for NX-API. And - not every command supports "| json" when using cli/ssh. As such, we assume - if | json returns an XML string, it is a valid command, but that the - resource doesn't exist yet. - """ - if 'xml' in response[0]: - body = [] - else: - try: - body = [json.loads(response[0])] - except ValueError: - module.fail_json(msg='Command does not support JSON output', - command=command) - return body - - def execute_show(cmds, module, command_type=None): command_type_map = { 'cli_show': 'json', @@ -307,10 +289,8 @@ def execute_show(cmds, module, command_type=None): def execute_show_command(command, module, command_type='cli_show'): if module.params['transport'] == 'cli': - command += ' | json' cmds = [command] - response = execute_show(cmds, module) - body = get_cli_body_ssh(command, response, module) + body = execute_show(cmds, module) elif module.params['transport'] == 'nxapi': cmds = [command] body = execute_show(cmds, module, command_type=command_type) |