summaryrefslogtreecommitdiffstats
path: root/openntpd-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-20 00:39:12 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-20 00:39:12 +0000
commit34bae88186d493a274569a8a2f510a9ee85ec134 (patch)
tree753aff4eb72e17d1df334ea8557143f915816c2f /openntpd-model.lua
parent801ff66ed8f97603056698f8e8349dcb716665a3 (diff)
downloadacf-openntpd-34bae88186d493a274569a8a2f510a9ee85ec134.tar.bz2
acf-openntpd-34bae88186d493a274569a8a2f510a9ee85ec134.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpful in revealing places where the code relied on the global environment.
Diffstat (limited to 'openntpd-model.lua')
-rw-r--r--openntpd-model.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/openntpd-model.lua b/openntpd-model.lua
index 44139c1..f5607f5 100644
--- a/openntpd-model.lua
+++ b/openntpd-model.lua
@@ -1,4 +1,4 @@
-module (..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -52,19 +52,19 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "OpenNTPD Status")
end
-function getstatusdetails()
+function mymodule.getstatusdetails()
local status = {}
status.timechanged = cfe({ value=last_time_change(), label="Previous time adjustment" })
@@ -73,7 +73,7 @@ function getstatusdetails()
return cfe({ type="group", value=status, label="OpenNTPD Detailed Status" })
end
-function read_config ()
+function mymodule.read_config ()
local config = {}
config.server = cfe({ type="list", value={}, label="Single servers", descr="List of server IP addresses/hostnames. OpenNTPD will attempt to synchronize to one resolved address for each hostname entry.", seq=3 })
config.servers = cfe({ type="list", value={}, label="Multiple servers", descr="List of server IP addresses/hostnames. OpenNTPD will attempt to synchronize to all resolved addresses for each hostname entry.", seq=4 })
@@ -99,7 +99,7 @@ function read_config ()
return cfe({ type="group", value=config, label="OpenNTPD Config" })
end
-function update_config(self, config)
+function mymodule.update_config(self, config)
local success, config = validate_config(config)
if success then
@@ -154,11 +154,12 @@ function update_config(self, config)
return config
end
-function get_filedetails()
+function mymodule.get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
-function update_filedetails(self, filedetails)
+function mymodule.update_filedetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
+return mymodule