From 2beb00dd81c1f2dceeef0e62cf89d2d1b1109b6a Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Fri, 30 Nov 2007 16:41:55 +0000 Subject: Check and restart is now working! git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@396 ab2d0c66-481e-0410-8bed-d214d4d58bed --- shorewall-controller.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'shorewall-controller.lua') diff --git a/shorewall-controller.lua b/shorewall-controller.lua index 094dcf9..07ec0b7 100644 --- a/shorewall-controller.lua +++ b/shorewall-controller.lua @@ -17,8 +17,23 @@ mvc.on_load = function(self, parent) end +check = function(self) + if self.clientdata.cmd == "restart" then + return ( {programstats = self.model:restart_service(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) + end + return ( {check = self.model:check_config(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) +end + read = function(self) + if self.clientdata.cmd == "check" then + self.conf.action = "check" + self.conf.type = "redir" + error (self.conf) + end + if self.clientdata.cmd == "restart" then + return ( {programstats = self.model:restart_service(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) + end return ( {programstats = self.model:get_status(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) end @@ -29,7 +44,7 @@ end edit = function (self) local filename = self.clientdata.name or "" local filecontent = self.clientdata.modifications or "" - if self.clientdata.cmd == "update" then + if ( filecontent ~= "") then local me = ( {filecontent = self.model:update_filecontent(filename,filecontent), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } ) if ( me.filecontent == nil ) then list_redir(self) -- cgit v1.2.3