Fixes #28779 eth_mode key error (#28782)

* Fixes #28779 eth_mode key error

* Remove unused get_config references

* Addressed PR comment
This commit is contained in:
Mike Wiebe 2017-08-29 17:07:46 -04:00 committed by Nathaniel Case
commit d9fc3def94
2 changed files with 2 additions and 8 deletions

View file

@ -141,7 +141,7 @@ commands:
sample: ["interface port-channel101", "shutdown"]
'''
from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule
@ -280,7 +280,7 @@ def get_interface(intf, module):
if body:
interface_table = body['TABLE_interface']['ROW_interface']
if interface_table['eth_mode'] == 'fex-fabric':
if interface_table.get('eth_mode') == 'fex-fabric':
module.fail_json(msg='nxos_interface does not support interfaces with mode "fex-fabric"')
intf_type = get_interface_type(intf)
if intf_type in ['portchannel', 'ethernet']:
@ -700,8 +700,6 @@ def main():
cmds.extend(cmds2)
end_state, is_default = smart_existing(module, intf_type,
normalized_interface)
else:
end_state = get_interfaces_dict(module)[interface_type]
cmds = [cmd for cmd in cmds if cmd != 'configure']
results['commands'] = cmds