1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixing module behavior when route_target_both is used (#20076)

This commit is contained in:
Gabriele 2017-03-25 05:02:15 -07:00 committed by Peter Sprygada
parent 6a414371a1
commit 9b2bdf2df6

View file

@ -208,12 +208,26 @@ def apply_key_map(key_map, table):
return new_dict return new_dict
def fix_proposed(proposed_commands):
new_proposed = {}
for key, value in proposed_commands.items():
if key == 'route-target both':
new_proposed['route-target export'] = value
new_proposed['route-target import'] = value
else:
new_proposed[key] = value
return new_proposed
def state_present(module, existing, proposed): def state_present(module, existing, proposed):
commands = list() commands = list()
parents = list() parents = list()
proposed_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, proposed) proposed_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, proposed)
existing_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, existing) existing_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, existing)
if proposed_commands.get('route-target both'):
proposed_commands = fix_proposed(proposed_commands)
for key, value in proposed_commands.items(): for key, value in proposed_commands.items():
if key.startswith('route-target'): if key.startswith('route-target'):
if value == ['default']: if value == ['default']: