From 1ccb6f9f494a552d1d0004906d0463ddcdf374db Mon Sep 17 00:00:00 2001 From: Ruben van Dijk <15885455+RubenNL@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:58:17 +0100 Subject: T7964 - Fix edgecase with empty `commands` array. (#439) * T7964 - Add failing test. * T7964 - Fix "IndexError: list index out of range". --- .../module_utils/network/vyos/config/firewall_global/firewall_global.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/module_utils') diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py index 16a91d4e..ddb4af80 100644 --- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py +++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py @@ -368,7 +368,7 @@ class Firewall_global(ConfigBase): ) elif not opr and key in l_set: if key == "name" and self._is_grp_del(h, want, key): - if commands[-1] == cmd + " " + want["name"] + " " + self._grp_type( + if len(commands) > 0 and commands[-1] == cmd + " " + want["name"] + " " + self._grp_type( attr, ): commands.pop() -- cgit v1.2.3