fixes error when trying to run show start over eapi (#26800)

This commit is contained in:
Peter Sprygada 2017-07-14 09:07:44 -04:00 committed by Ricardo Carrillo Cruz
commit 3bbb32cac5
3 changed files with 54 additions and 7 deletions

View file

@ -170,15 +170,15 @@ options:
changes are not copied to non-volatile storage by default. Using
this argument will change that before. If the argument is set to
I(always), then the running-config will always be copied to the
startup-config and the I(changed) flag will always be set to
True. If the argument is set to I(changed), then the running-config
startup-config and the I(modified) flag will always be set to
True. If the argument is set to I(modified), then the running-config
will only be copied to the startup-config if it has changed since
the last save to startup-config. If the argument is set to
I(never), the running-config will never be copied to the the
startup-config
required: false
default: never
choices: ['always', 'never', 'changed']
choices: ['always', 'never', 'modified']
version_added: "2.4"
diff_against:
description:
@ -316,7 +316,7 @@ def main():
defaults=dict(type='bool', default=False),
backup=dict(type='bool', default=False),
save_when=dict(choices=['always', 'never', 'changed'], default='never'),
save_when=dict(choices=['always', 'never', 'modified'], default='never'),
diff_against=dict(choices=['startup', 'session', 'intended', 'running'], default='session'),
diff_ignore_lines=dict(type='list'),
@ -408,7 +408,8 @@ def main():
diff_ignore_lines = module.params['diff_ignore_lines']
if module.params['save_when'] != 'never':
output = run_commands(module, ['show running-config', 'show startup-config'])
output = run_commands(module, [{'command': 'show running-config', 'output': 'text'},
{'command': 'show startup-config', 'output': 'text'}])
running_config = NetworkConfig(indent=1, contents=output[0], ignore_lines=diff_ignore_lines)
startup_config = NetworkConfig(indent=1, contents=output[1], ignore_lines=diff_ignore_lines)
@ -425,7 +426,7 @@ def main():
if module._diff:
if not running_config:
output = run_commands(module, 'show running-config')
output = run_commands(module, {'command': 'show running-config', 'output': 'text'})
contents = output[0]
else:
contents = running_config.config_text
@ -442,7 +443,7 @@ def main():
elif module.params['diff_against'] == 'startup':
if not startup_config:
output = run_commands(module, 'show startup-config')
output = run_commands(module, {'command': 'show startup-config', 'output': 'text'})
contents = output[0]
else:
contents = startup_config.config_text