Skip to content

Commit

Permalink
gluon-core: fix invalid role configurations during reconfigure
Browse files Browse the repository at this point in the history
(cherry picked from commit a31a802)
  • Loading branch information
lemoer authored and herbetom committed Dec 11, 2023
1 parent 1d0a30f commit 10d8a42
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,19 @@ for iface in pairs(interfaces) do
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')

0 comments on commit 10d8a42

Please sign in to comment.