diff --git a/lib/ansible/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py b/lib/ansible/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py index 6af98a51cca..ffd2f366765 100644 --- a/lib/ansible/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py +++ b/lib/ansible/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py @@ -199,15 +199,15 @@ class Lacp_interfaces(ConfigBase): def generate_commands(interface, to_set, to_remove): commands = [] + for key in to_remove.keys(): + commands.append("no lacp {0}".format(key.replace("_", "-"))) + for key, value in to_set.items(): if value is None: continue commands.append("lacp {0} {1}".format(key.replace("_", "-"), value)) - for key in to_remove.keys(): - commands.append("no lacp {0}".format(key.replace("_", "-"))) - if commands: commands.insert(0, "interface {0}".format(interface)) diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml index d11c350128e..f33b32fd15e 100644 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml +++ b/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml @@ -5,6 +5,7 @@ config: - name: Ethernet1 rate: fast + port_priority: 45 other_config: - name: Ethernet2 rate: fast