|
|
|
@ -82,16 +82,11 @@ def map_obj_to_commands(updates, module):
|
|
|
|
|
want, have = updates
|
|
|
|
|
commands = list()
|
|
|
|
|
|
|
|
|
|
if want['state'] == 'present' and have['state'] == 'absent':
|
|
|
|
|
commands.append(
|
|
|
|
|
'set system services netconf ssh port %s' % want['netconf_port']
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
elif want['state'] == 'absent' and have['state'] == 'present':
|
|
|
|
|
if want['state'] == 'absent':
|
|
|
|
|
if have['state'] == 'present':
|
|
|
|
|
commands.append('delete system services netconf')
|
|
|
|
|
|
|
|
|
|
elif want['state'] == 'present':
|
|
|
|
|
if want['netconf_port'] != have.get('netconf_port'):
|
|
|
|
|
else:
|
|
|
|
|
if have['state'] == 'absent' or want['netconf_port'] != have.get('netconf_port'):
|
|
|
|
|
commands.append(
|
|
|
|
|
'set system services netconf ssh port %s' % want['netconf_port']
|
|
|
|
|
)
|
|
|
|
@ -113,7 +108,7 @@ def map_config_to_obj(module):
|
|
|
|
|
config = str(out).strip()
|
|
|
|
|
|
|
|
|
|
obj = {'state': 'absent'}
|
|
|
|
|
if config:
|
|
|
|
|
if 'ssh' in config:
|
|
|
|
|
obj.update({
|
|
|
|
|
'state': 'present',
|
|
|
|
|
'netconf_port': parse_port(config)
|
|
|
|
|