Merge pull request #4910 from GGabriele/feature_fix

Fix nxos_feature 2.2
reviewable/pr18780/r1
Peter Sprygada 8 years ago committed by GitHub
commit 539e39df8d

@ -247,6 +247,15 @@ def execute_config_command(commands, module):
clie = get_exception() clie = get_exception()
module.fail_json(msg='Error sending CLI commands', module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands) error=str(clie), commands=commands)
except AttributeError:
try:
commands.insert(0, 'configure')
module.cli.add_commands(commands, output='config')
module.cli.run_commands()
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
def get_cli_body_ssh(command, response, module): def get_cli_body_ssh(command, response, module):
@ -381,11 +390,30 @@ def validate_feature(module, mode='show'):
feature_to_be_mapped = { feature_to_be_mapped = {
'show': { 'show': {
'nv overlay': 'nve', 'nv overlay': 'nve',
'vn-segment-vlan-based': 'vnseg_vlan'}, 'vn-segment-vlan-based': 'vnseg_vlan',
'hsrp': 'hsrp_engine',
'fabric multicast': 'fabric_mcast',
'scp-server': 'scpServer',
'sftp-server': 'sftpServer',
'sla responder': 'sla_responder',
'sla sender': 'sla_sender',
'ssh': 'sshServer',
'tacacs+': 'tacacs',
'telnet': 'telnetServer'},
'config': 'config':
{ {
'nve': 'nv overlay', 'nve': 'nv overlay',
'vnseg_vlan': 'vn-segment-vlan-based'} 'vnseg_vlan': 'vn-segment-vlan-based',
'hsrp_engine': 'hsrp',
'fabric_mcast': 'fabric multicast',
'scpServer': 'scp-server',
'sftpServer': 'sftp-server',
'sla_sender': 'sla sender',
'sla_responder': 'sla responder',
'sshServer': 'ssh',
'tacacs': 'tacacs+',
'telnetServer': 'telnet',
}
} }
if feature in feature_to_be_mapped[mode]: if feature in feature_to_be_mapped[mode]:
@ -434,6 +462,8 @@ def main():
updated_features = get_available_features(feature, module) updated_features = get_available_features(feature, module)
existstate = updated_features[feature] existstate = updated_features[feature]
end_state = dict(state=existstate) end_state = dict(state=existstate)
if 'configure' in cmds:
cmds.pop(0)
results = {} results = {}
results['proposed'] = proposed results['proposed'] = proposed

Loading…
Cancel
Save