fix nxos_igmp issues (#38496)

This commit is contained in:
saichint 2018-04-09 21:05:58 -07:00 committed by Trishna Guha
commit 361437b042
2 changed files with 37 additions and 9 deletions

View file

@ -132,10 +132,12 @@ def main():
commands.append('no ip igmp enforce-router-alert')
elif state == 'present':
if desired['flush_routes'] and not current['flush_routes']:
commands.append('ip igmp flush-routes')
if desired['enforce_rtr_alert'] and not current['enforce_rtr_alert']:
commands.append('ip igmp enforce-router-alert')
ldict = {'flush_routes': 'flush-routes', 'enforce_rtr_alert': 'enforce-router-alert'}
for arg in ['flush_routes', 'enforce_rtr_alert']:
if desired[arg] and not current[arg]:
commands.append('ip igmp {0}'.format(ldict.get(arg)))
elif current[arg] and not desired[arg]:
commands.append('no ip igmp {0}'.format(ldict.get(arg)))
result = {'changed': False, 'updates': commands, 'warnings': warnings}
@ -145,7 +147,8 @@ def main():
result['changed'] = True
if module.params['restart']:
run_commands(module, 'restart igmp')
cmd = {'command': 'restart igmp', 'output': 'text'}
run_commands(module, cmd)
module.exit_json(**result)