fix *os_config module backward diff (#35332)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/35350/head
Trishna Guha 7 years ago committed by GitHub
parent 2f46f8f944
commit cff4a2d26e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -458,9 +458,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines) base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
if running_config.sha1 != base_config.sha1: if running_config.sha1 != base_config.sha1:
if module.params['diff_against'] == 'intended':
before = running_config
after = base_config
elif module.params['diff_against'] in ('startup', 'running'):
before = base_config
after = running_config
result.update({ result.update({
'changed': True, 'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)} 'diff': {'before': str(before), 'after': str(after)}
}) })
module.exit_json(**result) module.exit_json(**result)

@ -532,9 +532,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines) base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
if running_config.sha1 != base_config.sha1: if running_config.sha1 != base_config.sha1:
if module.params['diff_against'] == 'intended':
before = running_config
after = base_config
elif module.params['diff_against'] in ('startup', 'running'):
before = base_config
after = running_config
result.update({ result.update({
'changed': True, 'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)} 'diff': {'before': str(before), 'after': str(after)}
}) })
module.exit_json(**result) module.exit_json(**result)

@ -493,9 +493,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines) base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
if running_config.sha1 != base_config.sha1: if running_config.sha1 != base_config.sha1:
if module.params['diff_against'] == 'intended':
before = running_config
after = base_config
elif module.params['diff_against'] in ('startup', 'running'):
before = base_config
after = running_config
result.update({ result.update({
'changed': True, 'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)} 'diff': {'before': str(before), 'after': str(after)}
}) })
module.exit_json(**result) module.exit_json(**result)

Loading…
Cancel
Save