From 88662d0c56ca672a07ebfd7906959878ff2ea45f Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 13 Apr 2018 13:20:23 +0530 Subject: [PATCH] Fix in eos get_config cliconf api (#38682) If format is passed as None to get_config api, wrong command is genereted ie. `show running-configuration | None | section interface`. Add format type in command only if format value is either not `text` or `None`. --- lib/ansible/plugins/cliconf/eos.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/ansible/plugins/cliconf/eos.py b/lib/ansible/plugins/cliconf/eos.py index b6fda0c9b2..bc21dec3e6 100644 --- a/lib/ansible/plugins/cliconf/eos.py +++ b/lib/ansible/plugins/cliconf/eos.py @@ -51,13 +51,12 @@ class Cliconf(CliconfBase): lookup = {'running': 'running-config', 'startup': 'startup-config'} if source not in lookup: return self.invalid_params("fetching configuration from %s is not supported" % source) - if format == 'text': - cmd = b'show %s ' % lookup[source] - else: - cmd = b'show %s | %s' % (lookup[source], format) - flags = [] if flags is None else flags - cmd += ' '.join(flags) + cmd = b'show %s ' % lookup[source] + if format and format is not 'text': + cmd += b'| %s ' % format + + cmd += ' '.join(to_list(flags)) cmd = cmd.strip() return self.send_command(cmd)