Actually fix eos_facts feature detection

This commit is contained in:
Nathaniel Case 2018-07-23 13:06:41 -04:00 committed by Matt Clay
parent fb6ef26e39
commit ee62c8ffbc
3 changed files with 7 additions and 6 deletions

View file

@ -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):

View file

@ -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):

View file

@ -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)