Fixing nxos_feature

This commit is contained in:
GGabriele 2016-09-13 22:59:44 +02:00 committed by Matt Clay
parent f916dae700
commit e375b4c61c

View file

@ -835,18 +835,23 @@ def apply_key_map(key_map, table):
def get_available_features(feature, module):
available_features = {}
feature_regex = '(?P<feature>\S+)\s+\d+\s+(?P<state>.*)'
command = 'show feature'
body = execute_show_command(command, module)
body = execute_show_command(command, module, command_type='cli_show_ascii')
split_body = body[0].splitlines()
for line in split_body:
try:
body = body[0]['TABLE_cfcFeatureCtrlTable']['ROW_cfcFeatureCtrlTable']
except (TypeError, IndexError):
return available_features
for each_feature in body:
feature = each_feature['cfcFeatureCtrlName2']
state = each_feature['cfcFeatureCtrlOpStatus2']
match_feature = re.match(feature_regex, line, re.DOTALL)
feature_group = match_feature.groupdict()
feature = feature_group['feature']
state = feature_group['state']
except AttributeError:
feature = ''
state = ''
if feature and state:
if 'enabled' in state:
state = 'enabled'
@ -860,9 +865,9 @@ def get_available_features(feature, module):
return available_features
def get_commands(proposed, existing, state, module):
feature = validate_feature(module, mode='config')
commands = []
feature_check = proposed == existing
if not feature_check: