mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 20:30:21 -07:00
eos_l2_interface handle "Interface does not exist" (#56787)
* Quick and dirty attempt to handle eapi error * Well this should probably change * Hopefully this works correctly? * Fix check_rc handling with httpapi * Add tests that should hopefully cover the error * Fix warnings * Improve tests
This commit is contained in:
parent
5005c353ef
commit
cebb363fcc
4 changed files with 78 additions and 7 deletions
|
@ -211,8 +211,8 @@ def map_config_to_obj(module, warnings):
|
|||
for item in set(match):
|
||||
command = {'command': 'show interfaces {0} switchport | include Switchport'.format(item),
|
||||
'output': 'text'}
|
||||
command_result = run_commands(module, command)
|
||||
if command_result[0] == "% Interface does not exist":
|
||||
command_result = run_commands(module, command, check_rc=False)
|
||||
if "Interface does not exist" in command_result[0]:
|
||||
warnings.append("Could not gather switchport information for {0}: {1}".format(item, command_result[0]))
|
||||
continue
|
||||
elif command_result[0] != "":
|
||||
|
@ -298,9 +298,7 @@ def main():
|
|||
supports_check_mode=True)
|
||||
|
||||
warnings = list()
|
||||
result = {'changed': False}
|
||||
if warnings:
|
||||
result['warnings'] = warnings
|
||||
result = {'changed': False, 'warnings': warnings}
|
||||
|
||||
want = map_params_to_obj(module)
|
||||
have = map_config_to_obj(module, warnings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue