Fix networking bugs cherry-picked from devel (#35533)

* fix *os_config module backward diff (#35332)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit cff4a2d26e)

* bug-35431 fixed removing encryption from user on subsequent runs of the task (#35433)

(cherry picked from commit 2293252e52)

* Fix nxos terminal plugin to support certain commands

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* update changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-01-31 17:46:16 +05:30 committed by Toshio Kuratomi
parent 11081cbeda
commit 21255ae76d
6 changed files with 34 additions and 7 deletions

View file

@ -29,6 +29,12 @@ Ansible Changes By Release
(https://github.com/ansible/ansible/pull/35037)
* Fix azure_rm_virtualmachine creating VM with vnet in another resource group
(https://github.com/ansible/ansible/pull/35038)
* Fix nxos terminal plugin regex to support certain commands
(https://github.com/ansible/ansible/pull/35186)
* Fix network os_config modules backward diff
(https://github.com/ansible/ansible/pull/35332)
* Fix nxos_snmp_user removing encryption from user on subsequent runs of the task
(https://github.com/ansible/ansible/pull/35433)
<a id="2.4.3"></a>

View file

@ -457,9 +457,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

@ -531,9 +531,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

@ -455,9 +455,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)}
})

View file

@ -289,9 +289,6 @@ def main():
reset = True
proposed['encrypt'] = 'aes-128'
elif encrypt:
proposed['encrypt'] = 'aes-128'
delta = dict(set(proposed.items()).difference(existing.items()))
if delta.get('pwd'):
@ -300,6 +297,9 @@ def main():
if delta:
delta['group'] = group
if delta and encrypt:
delta['encrypt'] = 'aes-128'
command = config_snmp_user(delta, user, reset, new)
commands.append(command)

View file

@ -28,7 +28,7 @@ from ansible.errors import AnsibleConnectionFailure
class TerminalModule(TerminalBase):
terminal_stdout_re = [
re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)$'),
re.compile(br'[\r\n]?(\x1b\S+)*[a-zA-Z]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)*(\x1b\S+)*$'),
re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$')
]