summaryrefslogtreecommitdiffstats
path: root/acf
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-03-01 09:41:37 +0000
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-03-01 13:14:26 +0200
commita717300296191677eb4fe6e2ebe76827cde41e77 (patch)
treef7ac6819fad8e97e7f68ac7e0ebc83c7e8cd8b77 /acf
parent544ea51c3663070dadd588d9de3e22d6e045743e (diff)
downloadaconf-a717300296191677eb4fe6e2ebe76827cde41e77.tar.bz2
aconf-a717300296191677eb4fe6e2ebe76827cde41e77.tar.xz
adjusted the semantics of reference scope
Diffstat (limited to 'acf')
-rw-r--r--acf/model/init.lua6
-rw-r--r--acf/model/node.lua4
-rw-r--r--acf/modules/aaa.lua4
-rw-r--r--acf/modules/awall.lua14
4 files changed, 14 insertions, 14 deletions
diff --git a/acf/model/init.lua b/acf/model/init.lua
index 6934796..202c0e0 100644
--- a/acf/model/init.lua
+++ b/acf/model/init.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012 Kaarle Ritvanen
+Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -92,7 +92,7 @@ function Reference:init(params)
end
function Reference:abs_scope(path)
- return pth.to_absolute(self.scope, pth.parent(pth.parent(path)))
+ return pth.to_absolute(self.scope, pth.parent(path))
end
function Reference:meta(txn, path, addr)
@@ -136,7 +136,7 @@ function Reference:_validate(txn, path, value)
-- assume one-level ref for now
assert(not string.find(value, '/'))
if not self:follow(txn, path, value) then
- error('Does not exist: '..path)
+ error('Does not exist: '..value)
end
-- TODO check instance type
diff --git a/acf/model/node.lua b/acf/model/node.lua
index 39a0d92..083757c 100644
--- a/acf/model/node.lua
+++ b/acf/model/node.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012 Kaarle Ritvanen
+Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -76,7 +76,7 @@ function Collection:init(txn, path, addr, field, required)
local mt = getmetatable(self)
mt.field = BoundField(self, field)
- mt.meta = {type='collection', members=mt.field:meta()}
+ mt.meta = {type='collection', members=mt.field:meta('$')}
function mt.mmeta(name) return mt.meta.members end
function mt.members() return txn:get(addr) or {} end
diff --git a/acf/modules/aaa.lua b/acf/modules/aaa.lua
index 1704376..23cb6df 100644
--- a/acf/modules/aaa.lua
+++ b/acf/modules/aaa.lua
@@ -8,12 +8,12 @@ module(..., package.seeall)
local M = require('acf.model')
Role = M.new()
-Role.permissions = M.Collection{type=M.Reference{scope='../../permissions'}}
+Role.permissions = M.Collection{type=M.Reference{scope='../../../permissions'}}
User = M.new()
User.password = M.String
User.real_name = M.String
-User.roles = M.Collection{type=M.Reference{scope='../../roles'}}
+User.roles = M.Collection{type=M.Reference{scope='../../../roles'}}
function User:check_password(password) return password == self.password end
Authentication = M.new()
diff --git a/acf/modules/awall.lua b/acf/modules/awall.lua
index 8d25638..7d147f4 100644
--- a/acf/modules/awall.lua
+++ b/acf/modules/awall.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012 Kaarle Ritvanen
+Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -76,30 +76,30 @@ LogClass.limit = M.Integer
LogClass.prefix = M.String
IPSetReference = M.new()
-IPSetReference.name = M.Reference{scope='../../ipset', required=true}
+IPSetReference.name = M.Reference{scope='../../../ipset', required=true}
IPSetReference.args = M.Collection{type=Direction, required=true}
Rule = M.new()
-Rule['in'] = M.Collection{type=M.Reference{scope='../../zone'}}
-Rule.out = M.Collection{type=M.Reference{scope='../../zone'}}
+Rule['in'] = M.Collection{type=M.Reference{scope='../../../zone'}}
+Rule.out = M.Collection{type=M.Reference{scope='../../../zone'}}
Rule.src = M.Collection{type=M.String}
Rule.dest = M.Collection{type=M.String}
Rule.ipset = IPSetReference
Rule.ipsec = Direction
-Rule.service = M.Collection{type=M.Reference{scope='../../service'}}
+Rule.service = M.Collection{type=M.Reference{scope='../../../service'}}
Rule.action = M.String{choice={'accept'}}
-- TODO no service field
PolicyRule = M.new(Rule)
-PolicyRule.log = M.Reference{scope='../log'}
+PolicyRule.log = M.Reference{scope='../../log'}
PolicyRule.action = M.String{required=true,
choice={'accept', 'drop', 'reject', 'tarpit'}}
Limit = M.new()
Limit.count = M.Integer
Limit.interval = M.Integer
-Limit.log = M.Reference{scope='../../log'}
+Limit.log = M.Reference{scope='../../../log'}
FilterRule = M.new(PolicyRule)
FilterRule['conn-limit'] = Limit