gluon-core: fix invalid role configurations during reconfigure

This commit is contained in:
lemoer 2022-12-16 00:29:29 +01:00
parent 1e21dbcfad
commit a31a802e85

View File

@ -63,4 +63,19 @@ for iface in pairs(interfaces) do
end end
end end
-- Fix invalid role configurations
uci:foreach('gluon', 'interface', function(interface)
local function has_role(role)
return util.contains(interface.role, role)
end
if has_role('client') and (has_role('mesh') or has_role('uplink')) then
-- remove 'client' role
util.remove_from_set(interface.role, 'client')
uci:set('gluon', interface['.name'], 'role', interface.role)
end
end)
uci:save('gluon') uci:save('gluon')