From 2dfa8b8db4418126351c7828acf3afd1b7eda19b Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Thu, 14 Dec 2023 12:03:15 +0100
Subject: [PATCH] gluon-core: use delete_all instead of iterated delete

Use a delete_call with a boolean parameter function instead of manually
iterating over all devices.

Link: https://github.com/freifunk-gluon/gluon/pull/3102

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
index 9c155fb0..22bf7bb8 100755
--- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
+++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
@@ -93,10 +93,8 @@ end
 -- Delete all UCI device sections of type 'bridge'
 -- as well as the ones starting with 'br-'.
 -- Preserve all others to apply MAC address stored in UCI
-uci:foreach('network', 'device',function(s)
-	if s.type == 'bridge' or s.name:match('^br-') then
-		uci:delete('network', s['.name'])
-	end
+uci:delete_all('network', 'device', function(dev)
+	return (dev.type == 'bridge' or dev.name:match('^br-'))
 end)
 
 uci:delete_all('network', 'interface')
-- 
GitLab