Fixing module behavior when route_target_both is used (#20076)

(cherry picked from commit 9b2bdf2df6)
This commit is contained in:
Gabriele 2017-03-25 05:02:15 -07:00 committed by Peter Sprygada
parent d1ed72ad37
commit 66481d3d2f

View file

@ -208,12 +208,26 @@ def apply_key_map(key_map, table):
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):
commands = list()
parents = list()
proposed_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, proposed)
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():
if key.startswith('route-target'):
if value == ['default']: