To fix EOS_FACTS failure when lldp will be disabled. (#42347)

* to fix the bug 41165

* adding the changelog file

* Hook check_rc failure up so that this will actually work

* Update eos_facts-failure.yml
pull/43174/head
Sumit Jaiswal 6 years ago committed by Matt Davis
parent f320b1507d
commit 30a0c88c35

@ -0,0 +1,4 @@
---
bugfixes:
- eos_facts - fix failure when lldp will be disabled
(https://github.com/ansible/ansible/pull/42347)

@ -176,7 +176,12 @@ class Cli:
prompt = None
answer = None
try:
out = connection.get(command, prompt, answer)
except ConnectionError as exc:
if check_rc:
raise
out = getattr(exc, 'err', exc)
out = to_text(out, errors='surrogate_or_strict')
try:
@ -338,7 +343,7 @@ class Eapi:
return response
def run_commands(self, commands):
def run_commands(self, commands, check_rc=True):
"""Runs list of commands on remote device and returns results
"""
output = None
@ -493,9 +498,9 @@ def get_config(module, flags=None):
return conn.get_config(flags)
def run_commands(module, commands):
def run_commands(module, commands, check_rc=True):
conn = get_connection(module)
return conn.run_commands(to_command(module, commands))
return conn.run_commands(to_command(module, commands), check_rc)
def load_config(module, config, commit=False, replace=False):

@ -153,7 +153,7 @@ class FactsBase(object):
self.responses = None
def populate(self):
self.responses = run_commands(self.module, list(self.COMMANDS))
self.responses = run_commands(self.module, list(self.COMMANDS), check_rc=False)
class Default(FactsBase):
@ -258,6 +258,7 @@ class Interfaces(FactsBase):
self.facts['interfaces'] = self.populate_interfaces(data)
data = self.responses[1]
if data:
self.facts['neighbors'] = self.populate_neighbors(data['lldpNeighbors'])
def populate_interfaces(self, data):

Loading…
Cancel
Save