Actually fix eos_facts feature detection

pull/43346/head
Nathaniel Case 6 years ago committed by Matt Clay
parent fb6ef26e39
commit ee62c8ffbc

@ -280,7 +280,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
@ -431,9 +431,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):

@ -25,7 +25,7 @@ import time
from itertools import chain
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.plugins.cliconf import CliconfBase, enable_mode
from ansible.plugins.connection.network_cli import Connection as NetworkCli
@ -137,12 +137,13 @@ class Cliconf(CliconfBase):
if check_rc:
raise
out = getattr(e, 'err', e)
out = to_text(out, errors='surrogate_or_strict')
if out is not None:
try:
out = json.loads(out)
except ValueError:
out = str(out).strip()
out = out.strip()
responses.append(out)

Loading…
Cancel
Save