Fall-back to show configuration on old IOSXR devices (#22900)

In old IOSXR versions, 'show commit changes diff' does not work.
Fall-back to 'show configuration' if that command fails so execution
can move forward.

Fixes #22235
This commit is contained in:
Ricardo Carrillo Cruz 2017-03-29 16:21:23 +02:00 committed by GitHub
parent 6c101087ac
commit cc7e09451a
4 changed files with 12 additions and 5 deletions

View file

@ -146,7 +146,7 @@ def main():
commands = [c.strip() for c in str(candidate).split('\n')]
if commands:
load_config(module, commands, not module.check_mode)
load_config(module, commands, result['warnings'], not module.check_mode)
result['changed'] = not module.check_mode
result['updates'] = commands

View file

@ -240,8 +240,8 @@ def run(module, result):
result['commands'] = commands
diff = load_config(module, commands, not check_mode,
replace_config, comment)
diff = load_config(module, commands, result['warnings'],
not check_mode, replace_config, comment)
if diff:
result['diff'] = dict(prepared=diff)
result['changed'] = True

View file

@ -243,7 +243,7 @@ def main():
if commands:
if not module.check_mode:
load_config(module, commands, commit=True)
load_config(module, commands, result['warnings'], commit=True)
result['changed'] = True
module.exit_json(**result)