summaryrefslogtreecommitdiffstats
path: root/dhcp-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp-controller.lua')
-rw-r--r--dhcp-controller.lua45
1 files changed, 39 insertions, 6 deletions
diff --git a/dhcp-controller.lua b/dhcp-controller.lua
index cca9a98..5e7df8f 100644
--- a/dhcp-controller.lua
+++ b/dhcp-controller.lua
@@ -13,7 +13,7 @@ end
local pvt = {}
mvc= {}
-mvc.on_load = function(self, parent)
+mvc.on_load = function( self, parent )
-- If they try to run a bogus action, send them to read
if ( rawget(self.worker, self.conf.action) == nil ) then
list_redir(self)
@@ -23,17 +23,17 @@ mvc.on_load = function(self, parent)
end
-mvc.pre_exec = function (self)
+mvc.pre_exec = function( self )
logit ("dhcpd-controller pre_exec activated")
-- pvt.parent_on_exec ()
end
-mvc.post_exec = function ( self )
+mvc.post_exec = function( self )
logit ("dhcpd-controller post_exec activated")
return pvt.parent_on_exec()
end
-dep = function ( self )
+dep = function( self )
-- do the dependancy check
msg = self.model.dep_check()
@@ -49,7 +49,36 @@ dep = function ( self )
return ( cfe ({ msg = msg }) )
end
-settings = function ( self )
+delnet = function( self )
+
+ local net = {}
+
+ if not self.clientdata.cmd then
+ list_redir(self)
+ end
+ if not self.clientdata.network then
+ list_redir(self)
+ end
+
+ local option = { script = ENV["SCRIPT_NAME"],
+ prefix = self.conf.prefix,
+ controller = self.conf.controller,
+ action = self.conf.action,
+ extra = ""
+ }
+
+ if self.clientdata.cmd == "delete" then
+ if self.clientdata.confirm == "yes" then
+ msg = self.model.subnet_delete( self.clientdata.network )
+ list_redir(self)
+ else
+ net = self.model.subnet_read( self.clientdata.network );
+ return ( cfe({ option = option, value = net, msg = msg }) )
+ end
+ end
+end
+
+settings = function( self )
if not self.clientdata.cmd then
list_redir(self)
@@ -156,6 +185,10 @@ home = function ( self )
srvctrl = self.model.service_control(self.clientdata.srvcmd)
end
end
+
+ if self.clientdata.cmd == "generate" then
+ genmsg = self.model.config_generate()
+ end
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
@@ -169,7 +202,7 @@ home = function ( self )
end
info.subnets = self.model.get_subnets()
- return ( cfe({ option = option, value = "", info = info }) )
+ return ( cfe({ option = option, value = "", genmsg = genmsg, info = info }) )
end
view = function ( self )