summaryrefslogtreecommitdiffstats
path: root/aconf/modules/network.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/modules/network.lua')
-rw-r--r--aconf/modules/network.lua30
1 files changed, 14 insertions, 16 deletions
diff --git a/aconf/modules/network.lua b/aconf/modules/network.lua
index 82a83ef..8c985ff 100644
--- a/aconf/modules/network.lua
+++ b/aconf/modules/network.lua
@@ -92,12 +92,6 @@ end
function Interface:is_removable() return self.class == 'logical' end
-function Interface:auto_set()
- for _, set in ipairs(self:fetch('../../enabled-ifaces')) do
- if M.node.contains(set, self) then return set end
- end
-end
-
function Interface:auto_vlan_tag()
local name = M.node.name(self)
local _, tag = name:match(vlan_pattern)
@@ -106,13 +100,14 @@ function Interface:auto_vlan_tag()
end
Interface.enabled = M.Boolean{
- compute=function(iface) return iface:auto_set() and true or false end,
+ compute=function(iface)
+ return M.node.contains(iface:fetch('../../enabled-ifaces'), iface)
+ end,
store=function(iface, value)
- local set = iface:auto_set()
- if value and not set then
- M.node.insert(iface:fetch('../../enabled-ifaces/1'), iface)
- elseif not value and set then set[iface] = nil end
- end
+ local set = iface:fetch('../../enabled-ifaces')
+ if value then M.node.insert(set, iface)
+ else set[iface] = nil end
+ end
}
Interface.class = M.String{
@@ -251,10 +246,13 @@ Net.resolver = M.Model{
model=Resolv, addr='/augeas/etc/resolv.conf', ui_name='DNS resolver'
}
-Net.enabled_ifaces = M.List{
- type=M.Set{type=M.Reference{scope='../../interfaces', on_delete='set-null'}},
- visible=false,
- addr=iface_aug_addr..'/auto/#'
+Net.enabled_ifaces = M.Set{
+ type=M.Reference{
+ scope='../interfaces',
+ addr=iface_aug_addr..'/auto/#/*/*',
+ on_delete='set-null'
+ },
+ visible=false
}
Net.interfaces = M.Collection{
type=Interface, addr=iface_aug_addr..'/iface/@', widget='inline'