diff options
author | Andreas Brodmann <andreas.brodmann@gmail.com> | 2007-11-13 12:25:31 +0000 |
---|---|---|
committer | Andreas Brodmann <andreas.brodmann@gmail.com> | 2007-11-13 12:25:31 +0000 |
commit | 32d2ee7237a11a56918ba4c5f69870826f8dc7f8 (patch) | |
tree | 64175b6bd76923de1be214cecb6accba93a68484 /dhcp-controller.lua | |
parent | a5145638e7e9d2d846c5c8dc9cf089435a9f6f1f (diff) | |
download | acf-dhcp-32d2ee7237a11a56918ba4c5f69870826f8dc7f8.tar.bz2 acf-dhcp-32d2ee7237a11a56918ba4c5f69870826f8dc7f8.tar.xz |
working beta release of dhcp config - special hosts config yet missing
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@300 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dhcp-controller.lua')
-rw-r--r-- | dhcp-controller.lua | 45 |
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 ) |