summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2016-06-08 19:09:53 +0000
committerTed Trask <ttrask01@yahoo.com>2016-06-08 19:09:53 +0000
commitdf0d2e0e18549e8fe348d08769c929340d75131e (patch)
treef09ae5e514fa99bb623b4d960beaff150b95dec3 /lib
parent3528f073595e2097de3b3acf0a2c40bd17bc485a (diff)
downloadacf-core-df0d2e0e18549e8fe348d08769c929340d75131e.tar.bz2
acf-core-df0d2e0e18549e8fe348d08769c929340d75131e.tar.xz
Cleanup due to changes in daemoncontrol to properly report errors
Diffstat (limited to 'lib')
-rw-r--r--lib/modelfunctions.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/modelfunctions.lua b/lib/modelfunctions.lua
index 3345dce..e9210ee 100644
--- a/lib/modelfunctions.lua
+++ b/lib/modelfunctions.lua
@@ -10,11 +10,12 @@ subprocess = require("subprocess")
function mymodule.getenabled(servicename)
local result = cfe({ label = "Program status", name=servicename })
result.value, result.errtxt = processinfo.daemoncontrol(servicename, "status")
- if string.find(result.value, ": not found") then
+ if result.errtxt then
result.value = ""
result.errtxt = "Program not installed"
else
- result.value = string.gsub(result.value, "* status: ", "")
+ -- We only want the part that comes after status:
+ result.value = string.gsub(result.value, "^.*%* status: ", "")
result.value = string.gsub(result.value, "^%l", string.upper)
end
return result
@@ -25,6 +26,7 @@ function mymodule.get_startstop(servicename)
local actions, descr = processinfo.daemon_actions(servicename)
local errtxt
if not actions then
+ actions = {}
errtxt = descr
else
for i,v in ipairs(actions) do