From 12528712171de73ccf2466b20dc43cf604685d48 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 17 Apr 2022 01:19:22 +0200 Subject: [PATCH] gluon-core: fix gluon.util.get_role_interfaces() with empty role list (#2472) The function failed when an interface has no roles assigned, breaking several upgrade scripts. Closes #2471 --- package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua index 7152bc4d..31ce6864 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua @@ -158,7 +158,8 @@ function M.get_role_interfaces(uci, role, exclusive) end uci:foreach('gluon', 'interface', function(s) - if M.contains(s.role, role) and (not exclusive or #s.role == 1) then + local roles = s.role or {} + if M.contains(roles, role) and (not exclusive or #roles == 1) then add(s.name) end end)