Skip to content
Snippets Groups Projects
Commit c4d37036 authored by David Bauer's avatar David Bauer
Browse files

gluon-core: dont fail on unset interface role


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: default avatarDavid Bauer <mail@david-bauer.net>
parent 3fdf6f67
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,10 @@ end ...@@ -68,6 +68,10 @@ end
uci:foreach('gluon', 'interface', function(interface) uci:foreach('gluon', 'interface', function(interface)
local function has_role(role) local function has_role(role)
if interface.role == nil then
return false
end
return util.contains(interface.role, role) return util.contains(interface.role, role)
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment