fix *os_config module backward diff (#35332)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-01-25 18:49:20 +05:30 committed by GitHub
parent 2f46f8f944
commit cff4a2d26e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

View file

@ -458,9 +458,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
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({
'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)}
'diff': {'before': str(before), 'after': str(after)}
})
module.exit_json(**result)

View file

@ -532,9 +532,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
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({
'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)}
'diff': {'before': str(before), 'after': str(after)}
})
module.exit_json(**result)

View file

@ -493,9 +493,16 @@ def main():
base_config = NetworkConfig(indent=1, contents=contents, ignore_lines=diff_ignore_lines)
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({
'changed': True,
'diff': {'before': str(base_config), 'after': str(running_config)}
'diff': {'before': str(before), 'after': str(after)}
})
module.exit_json(**result)