From c59d070321e4eb4334e0660a1682c3ca3f361f91 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Mon, 11 Dec 2023 05:07:10 +0100 Subject: [PATCH] gluon-core: dont fail on unset interface role (#3095) In case no interface role was selected for a given interface, gluon-reconfigure currently fails with Configuring: 021-interface-roles /usr/bin/lua: /usr/lib/lua/gluon/util.lua:25: bad argument #1 to 'pairs' (table expected, got nil) stack traceback: [C]: in function '?' /usr/lib/lua/simple-uci.lua:22: in function 'foreach' ./021-interface-roles:47: in main chunk [C]: ? Check we actually have a role set before accessing the table. Signed-off-by: David Bauer (cherry picked from commit c4d370367ed66ad05f596c0ffafcf813afd76809) --- .../gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles b/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles index 6e39219a69..6bceb36e55 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles @@ -68,6 +68,10 @@ end uci:foreach('gluon', 'interface', function(interface) local function has_role(role) + if interface.role == nil then + return false + end + return util.contains(interface.role, role) end