Skip to content

Commit

Permalink
Fix in eos get_config cliconf api (ansible#38682)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
ganeshrn committed Apr 13, 2018
1 parent 6de49f0 commit 88662d0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/ansible/plugins/cliconf/eos.py
Expand Up @@ -51,13 +51,12 @@ def get_config(self, source='running', format='text', flags=None):
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)

Expand Down

0 comments on commit 88662d0

Please sign in to comment.