mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
* Fixes #28779 eth_mode key error * Remove unused get_config references * Addressed PR comment
This commit is contained in:
parent
e9dd4717e5
commit
d9fc3def94
2 changed files with 2 additions and 8 deletions
|
@ -141,7 +141,7 @@ commands:
|
||||||
sample: ["interface port-channel101", "shutdown"]
|
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.nxos import nxos_argument_spec, check_args
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ def get_interface(intf, module):
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
interface_table = body['TABLE_interface']['ROW_interface']
|
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"')
|
module.fail_json(msg='nxos_interface does not support interfaces with mode "fex-fabric"')
|
||||||
intf_type = get_interface_type(intf)
|
intf_type = get_interface_type(intf)
|
||||||
if intf_type in ['portchannel', 'ethernet']:
|
if intf_type in ['portchannel', 'ethernet']:
|
||||||
|
@ -700,8 +700,6 @@ def main():
|
||||||
cmds.extend(cmds2)
|
cmds.extend(cmds2)
|
||||||
end_state, is_default = smart_existing(module, intf_type,
|
end_state, is_default = smart_existing(module, intf_type,
|
||||||
normalized_interface)
|
normalized_interface)
|
||||||
else:
|
|
||||||
end_state = get_interfaces_dict(module)[interface_type]
|
|
||||||
cmds = [cmd for cmd in cmds if cmd != 'configure']
|
cmds = [cmd for cmd in cmds if cmd != 'configure']
|
||||||
|
|
||||||
results['commands'] = cmds
|
results['commands'] = cmds
|
||||||
|
|
|
@ -37,13 +37,9 @@ class TestNxosInterfaceModule(TestNxosModule):
|
||||||
self.mock_load_config = patch('ansible.modules.network.nxos.nxos_interface.load_config')
|
self.mock_load_config = patch('ansible.modules.network.nxos.nxos_interface.load_config')
|
||||||
self.load_config = self.mock_load_config.start()
|
self.load_config = self.mock_load_config.start()
|
||||||
|
|
||||||
self.mock_get_config = patch('ansible.modules.network.nxos.nxos_interface.get_config')
|
|
||||||
self.get_config = self.mock_get_config.start()
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.mock_run_commands.stop()
|
self.mock_run_commands.stop()
|
||||||
self.mock_load_config.stop()
|
self.mock_load_config.stop()
|
||||||
self.mock_get_config.stop()
|
|
||||||
|
|
||||||
def load_fixtures(self, commands=None, device=''):
|
def load_fixtures(self, commands=None, device=''):
|
||||||
self.load_config.return_value = None
|
self.load_config.return_value = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue