mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Fix junos_netconf idempotency issues (#27804)
* Fix junos_netconf idempotency issues * Fix pep8 issue * Fix pep8 issue
This commit is contained in:
parent
2ad56c0700
commit
b51a1e9045
1 changed files with 6 additions and 11 deletions
|
@ -82,16 +82,11 @@ def map_obj_to_commands(updates, module):
|
||||||
want, have = updates
|
want, have = updates
|
||||||
commands = list()
|
commands = list()
|
||||||
|
|
||||||
if want['state'] == 'present' and have['state'] == 'absent':
|
if want['state'] == 'absent':
|
||||||
commands.append(
|
if have['state'] == 'present':
|
||||||
'set system services netconf ssh port %s' % want['netconf_port']
|
|
||||||
)
|
|
||||||
|
|
||||||
elif want['state'] == 'absent' and have['state'] == 'present':
|
|
||||||
commands.append('delete system services netconf')
|
commands.append('delete system services netconf')
|
||||||
|
else:
|
||||||
elif want['state'] == 'present':
|
if have['state'] == 'absent' or want['netconf_port'] != have.get('netconf_port'):
|
||||||
if want['netconf_port'] != have.get('netconf_port'):
|
|
||||||
commands.append(
|
commands.append(
|
||||||
'set system services netconf ssh port %s' % want['netconf_port']
|
'set system services netconf ssh port %s' % want['netconf_port']
|
||||||
)
|
)
|
||||||
|
@ -113,7 +108,7 @@ def map_config_to_obj(module):
|
||||||
config = str(out).strip()
|
config = str(out).strip()
|
||||||
|
|
||||||
obj = {'state': 'absent'}
|
obj = {'state': 'absent'}
|
||||||
if config:
|
if 'ssh' in config:
|
||||||
obj.update({
|
obj.update({
|
||||||
'state': 'present',
|
'state': 'present',
|
||||||
'netconf_port': parse_port(config)
|
'netconf_port': parse_port(config)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue