summaryrefslogtreecommitdiffstats
path: root/fetchcrl-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-04-18 16:22:30 +0000
committerTed Trask <ttrask01@yahoo.com>2012-04-18 16:22:30 +0000
commit3456da773e17156008cc6767ab425b87b737eafa (patch)
tree6b1724dcce94d22fcceb9c30f2fd359c9efc0419 /fetchcrl-model.lua
parente6a179c95704f7013b2024bb3491f1344ee695d4 (diff)
downloadacf-fetch-crl-3456da773e17156008cc6767ab425b87b737eafa.tar.bz2
acf-fetch-crl-3456da773e17156008cc6767ab425b87b737eafa.tar.xz
Fixed startstop to match new method
Diffstat (limited to 'fetchcrl-model.lua')
-rw-r--r--fetchcrl-model.lua43
1 files changed, 21 insertions, 22 deletions
diff --git a/fetchcrl-model.lua b/fetchcrl-model.lua
index 5cd3d62..7b68fd2 100644
--- a/fetchcrl-model.lua
+++ b/fetchcrl-model.lua
@@ -33,30 +33,29 @@ get_status = function()
return cfe({ type="group", value=status, label="Fetch-CRL Status" })
end
-function startstop_service(action)
- local result = {}
- result.actions = cfe({ type="list", value={"Download", "Delete"}, label="Start/Stop actions" })
- if action then
- result.result = cfe({ label="Start/Stop result" })
-
- if (string.lower(action) == "download") then
- local file = io.popen(path .. "fetch-crl 2>&1")
- if file ~= nil then
- result.result.value = file:read( "*a" )
- file:close()
- end
- elseif (string.lower(action) == "delete") then
- local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
- local dir = config.CRLDIR or outputdirectory
- for file in fs.find(".*\.r0", dir) do
- os.remove(file)
- end
- result.result.value = "Deleted CRL Files"
- else
- result.result.errtxt = "Unknown command!"
+function get_startstop(clientdata)
+ local actions = {"Download", "Delete"}
+ return cfe({ type="group", label="Management", value={}, option=actions })
+end
+
+function startstop_service(startstop, action)
+ if (string.lower(action) == "download") then
+ local file = io.popen(path .. "fetch-crl 2>&1")
+ if file ~= nil then
+ startstop.descr = file:read( "*a" )
+ file:close()
+ end
+ elseif (string.lower(action) == "delete") then
+ local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
+ local dir = config.CRLDIR or outputdirectory
+ for file in fs.find(".*\.r0", dir) do
+ os.remove(file)
end
+ startstop.descr = "Deleted CRL Files"
+ else
+ startstop.errtxt = "Unknown command!"
end
- return cfe({ type="group", value=result, label="Start/Stop result" })
+ return startstop
end
get_configfile = function()