Skip to content

Commit

Permalink
Address Arun's review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stalabi1 committed Jan 2, 2025
1 parent d629c38 commit b4f0599
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions plugins/module_utils/network/sonic/config/lst/lst.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.facts.facts import Facts
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import (
get_diff,
normalize_interface_name,
remove_empties,
update_states
)
Expand Down Expand Up @@ -105,16 +106,15 @@ def execute_module(self):
changed_lst_facts = self.get_lst_facts()

result['before'] = existing_lst_facts
if result['changed']:
result['after'] = changed_lst_facts

new_config = changed_lst_facts
old_config = existing_lst_facts
if self._module.check_mode:
result.pop('after', None)
new_config = get_new_config(commands, existing_lst_facts, TEST_KEYS_generate_config)
self.post_process_generated_config(new_config)
result['after(generated)'] = new_config
else:
new_config = self.get_lst_facts()
if result['changed']:
result['after'] = new_config
if self._module._diff:
self.sort_lists_in_config(new_config)
self.sort_lists_in_config(old_config)
Expand All @@ -133,8 +133,14 @@ def set_config(self, existing_lst_facts):
:returns: the commands necessary to migrate the current configuration
to the desired configuration
"""
want = remove_empties(self._module.params['config'])
want = self._module.params['config']
have = existing_lst_facts

if want:
want = remove_empties(want)
if want.get('interfaces'):
normalize_interface_name(want['interfaces'], self._module)

resp = self.set_state(want, have)
return to_list(resp)

Expand Down

0 comments on commit b4f0599

Please sign in to comment.