From 8a0967554fc72bc0b7a3cc7128ef92e77470e974 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Mon, 23 Jul 2018 14:51:44 -0400 Subject: [PATCH] Actually fix eos_facts feature detection (#43155) --- lib/ansible/module_utils/network/eos/eos.py | 2 +- lib/ansible/modules/network/eos/eos_facts.py | 2 +- lib/ansible/plugins/cliconf/eos.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/network/eos/eos.py b/lib/ansible/module_utils/network/eos/eos.py index d41497a711..424b73ebb0 100644 --- a/lib/ansible/module_utils/network/eos/eos.py +++ b/lib/ansible/module_utils/network/eos/eos.py @@ -239,7 +239,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 diff --git a/lib/ansible/modules/network/eos/eos_facts.py b/lib/ansible/modules/network/eos/eos_facts.py index ee1c54e0da..189a868f3f 100644 --- a/lib/ansible/modules/network/eos/eos_facts.py +++ b/lib/ansible/modules/network/eos/eos_facts.py @@ -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): diff --git a/lib/ansible/plugins/cliconf/eos.py b/lib/ansible/plugins/cliconf/eos.py index 3f7d549817..ef960d0319 100644 --- a/lib/ansible/plugins/cliconf/eos.py +++ b/lib/ansible/plugins/cliconf/eos.py @@ -213,12 +213,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 = to_text(out, errors='surrogate_or_strict').strip() + out = out.strip() responses.append(out) return responses