mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-18 14:21:06 -07:00
ios_facts: Add check to skip lldp neighbors if lldp doesn't exist or isn't enabled. (#40109)
* Add check to skip lldp neighbors if lldp doesn't exist or isn't enabled. * Re-enable check_rc on ios' run_commands
This commit is contained in:
parent
465114958e
commit
39bed45baf
2 changed files with 11 additions and 3 deletions
|
@ -29,7 +29,7 @@ import json
|
|||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.basic import env_fallback, return_values
|
||||
from ansible.module_utils.network.common.utils import to_list, ComplexList
|
||||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils.connection import Connection, ConnectionError
|
||||
|
||||
_DEVICE_CONFIGS = {}
|
||||
|
||||
|
@ -144,7 +144,13 @@ def run_commands(module, commands, check_rc=True):
|
|||
prompt = None
|
||||
answer = None
|
||||
|
||||
out = connection.get(command, prompt, answer)
|
||||
try:
|
||||
out = connection.get(command, prompt, answer)
|
||||
except ConnectionError as e:
|
||||
if check_rc:
|
||||
raise
|
||||
else:
|
||||
out = e
|
||||
|
||||
try:
|
||||
out = to_text(out, errors='surrogate_or_strict')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue