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
This commit is contained in:
Matthias Schiffer 2022-04-17 01:19:22 +02:00 committed by GitHub
parent 4225bd3853
commit 1252871217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)