summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aconf/model/field.lua8
-rw-r--r--aconf/modules/network.lua14
2 files changed, 11 insertions, 11 deletions
diff --git a/aconf/model/field.lua b/aconf/model/field.lua
index 658aa7f..8b300a5 100644
--- a/aconf/model/field.lua
+++ b/aconf/model/field.lua
@@ -69,7 +69,7 @@ function M.Field:init(params)
for _, param in ipairs{'compute', 'store', 'editable'} do
local func = self[param]
if type(func) == 'string' then
- self[param] = function(self, obj, ...) return obj[func](obj, ...) end
+ self[param] = function(obj, ...) return obj[func](obj, ...) end
end
end
@@ -112,7 +112,7 @@ function M.Field:_editable(context)
end
if type(self.editable) == 'function' then
- return self:editable(context.parent) and true or false
+ return self.editable(context.parent) and true or false
end
return self.editable
@@ -161,7 +161,7 @@ function M.Field:load(context)
end
function M.Field:_compute(context)
- return self:compute(context.parent, context.txn)
+ return self.compute(context.parent, context.txn)
end
function M.Field:_load(context) return context.txn:get(context.addr) end
@@ -209,7 +209,7 @@ function M.Field:validate(context, value) end
function M.Field:save(context, value)
self:check_editable(context)
- if self.store then self:store(context.parent, value, context.txn)
+ if self.store then self.store(context.parent, value, context.txn)
else self:_save(context, self:_validate(context, value)) end
end
diff --git a/aconf/modules/network.lua b/aconf/modules/network.lua
index ad772ed..9535fc4 100644
--- a/aconf/modules/network.lua
+++ b/aconf/modules/network.lua
@@ -106,8 +106,8 @@ function Interface:auto_vlan_tag()
end
Interface.enabled = M.Boolean{
- compute=function(self, iface) return iface:auto_set() and true or false end,
- store=function(self, iface, value)
+ compute=function(iface) return iface:auto_set() and true or false 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)
@@ -116,7 +116,7 @@ Interface.enabled = M.Boolean{
}
Interface.class = M.String{
- compute=function(self, iface, txn)
+ compute=function(iface, txn)
local name = M.node.name(iface)
if name == 'lo' then return 'loopback' end
@@ -139,19 +139,19 @@ Interface.class = M.String{
Interface.type = M.String{
condition={class='logical'},
- compute=function(self, iface)
+ compute=function(iface)
if #iface.slaves > 0 then return 'bond' end
if #iface.ports > 0 then return 'bridge' end
if iface.vlan_tag then return 'vlan' end
end,
- editable=function(self, iface) return not iface:auto_vlan_tag() end,
+ editable=function(iface) return not iface:auto_vlan_tag() end,
required=true,
choice={'bond', 'bridge', {'vlan', 'VLAN'}}
}
Interface.status = M.String{
visible=false,
- compute=function(self, obj)
+ compute=function(obj)
if obj.class == 'loopback' then return 'attached' end
for _, iface in M.node.pairs(M.node.parent(obj)) do
@@ -193,7 +193,7 @@ Interface.ports = M.Set{
-- TODO do not allow VLAN creation for non-existent interfaces
Interface.trunk = M.Reference{
condition={type='vlan'},
- compute=function(self, iface)
+ compute=function(iface)
local trunk = M.node.name(iface):match(vlan_pattern)
if trunk and iface:fetch('..')[trunk] then return trunk end
end,