summaryrefslogtreecommitdiffstats
path: root/acf2/modules
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-20 18:28:29 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-20 19:28:52 +0200
commita560b76c7b46f067637a79b01f923d377339a5c3 (patch)
treeffe84d72c235ec92e28ad492bdcb92c2ec13111a /acf2/modules
parent4cd12d27f2ddf5c5a65f43d544f3cc126b5d1d98 (diff)
downloadacf2-a560b76c7b46f067637a79b01f923d377339a5c3.tar.bz2
acf2-a560b76c7b46f067637a79b01f923d377339a5c3.tar.xz
model: allow different representation of choices in MF and PM
Diffstat (limited to 'acf2/modules')
-rw-r--r--acf2/modules/network.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/acf2/modules/network.lua b/acf2/modules/network.lua
index 32b9d20..186da13 100644
--- a/acf2/modules/network.lua
+++ b/acf2/modules/network.lua
@@ -46,8 +46,13 @@ M.defer(iface_aug_addr)
local IPv4 = M.new()
IPv4.method = M.String{
required=true,
- default='manual',
- choice={{'dhcp', 'DHCP'}, {'loopback', enabled=false}, 'manual', 'static'}
+ choice={
+ {'dhcp', 'DHCP'},
+ {'loopback', enabled=false},
+ {'unconfigured', be_value='manual'},
+ 'static'
+ },
+ default='unconfigured'
}
IPv4.address = M.net.IPv4Address{
condition={method='static'}, required=true, cidr=true, mask_addr='netmask'
@@ -58,8 +63,10 @@ IPv4.gateway = M.net.IPv4Address{condition={method='static'}}
local IPv6 = M.new()
IPv6.method = M.String{
required=true,
- choice={{'loopback', enabled=false}, 'manual', 'static'},
- default='manual'
+ choice={
+ {'loopback', enabled=false}, {'unconfigured', be_value='manual'}, 'static'
+ },
+ default='unconfigured'
}
IPv6.address = M.net.IPv6Address{
condition={method='static'}, required=true, cidr=true, mask_addr='netmask'
@@ -74,7 +81,7 @@ function Interface:validate()
if self.status == 'attached' then
for _, version in ipairs{4, 6} do
self['ipv'..version].method =
- self.class == 'loopback' and 'loopback' or 'manual'
+ self.class == 'loopback' and 'loopback' or 'unconfigured'
end
end
end
@@ -158,7 +165,7 @@ Interface.status = M.String{
end
for _, version in ipairs{4, 6} do
- if obj['ipv'..version].method ~= 'manual' then
+ if obj['ipv'..version].method ~= 'unconfigured' then
return 'configured'
end
end
@@ -262,7 +269,7 @@ return function(txn)
if ifaces[name].class == 'logical' then ifaces[name] = nil
else
for _, version in ipairs{4, 6} do
- ifaces[name]['ipv'..version].method = 'manual'
+ ifaces[name]['ipv'..version].method = 'unconfigured'
end
end
end