From f536eae80f37f55d61d31b960042c368ca09d41e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 28 Apr 2012 12:01:51 +0000 Subject: Updated for handle_form now passing self to get and set functions --- chrony-model.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'chrony-model.lua') diff --git a/chrony-model.lua b/chrony-model.lua index 0a4ab7c..350dd8b 100644 --- a/chrony-model.lua +++ b/chrony-model.lua @@ -67,14 +67,14 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function get_startstop(clientdata) +function get_startstop(self, clientdata) local retval = modelfunctions.get_startstop(processname) retval.option[#retval.option+1] = "Online" retval.option[#retval.option+1] = "Offline" return retval end -function startstop_service(startstop, action) +function startstop_service(self, startstop, action) local lower = action:lower() if lower == "online" or lower == "offline" then -- try to find the password @@ -159,7 +159,7 @@ function get_config() return cfe({ type="group", value=output, label="Chrony Config" }) end -function update_config(config) +function update_config(self, config) local success, config = validate_config(config) if success then @@ -213,8 +213,8 @@ function get_keyfiledetails() return get_keyfilestatus(modelfunctions.getfiledetails(keyfile)) end -function update_keyfiledetails(filedetails) - return get_keyfilestatus(modelfunctions.setfiledetails(filedetails, {keyfile})) +function update_keyfiledetails(self, filedetails) + return get_keyfilestatus(modelfunctions.setfiledetails(self, filedetails, {keyfile})) end function get_enable_keyfile() @@ -222,10 +222,10 @@ function get_enable_keyfile() return cfe({ type="group", value=result, label="Enable Key File" }) end -function enable_keyfile(enablerequest) +function enable_keyfile(self, enablerequest) local config = get_config() config.value.keyfile.value = keyfile - config = update_config(config) + config = update_config(self, config) if config.errtxt then enablerequest.errtxt = {config.errtxt} for name,val in pairs(config.value) do @@ -243,8 +243,8 @@ function get_filedetails() return modelfunctions.getfiledetails(configfile) end -function update_filedetails(filedetails) +function update_filedetails(self, filedetails) -- FIXME validate - return modelfunctions.setfiledetails(filedetails, {configfile}) + return modelfunctions.setfiledetails(self, filedetails, {configfile}) end -- cgit v1.2.3