From df0d2e0e18549e8fe348d08769c929340d75131e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 8 Jun 2016 19:09:53 +0000 Subject: Cleanup due to changes in daemoncontrol to properly report errors --- lib/modelfunctions.lua | 6 ++++-- 1 file 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 -- cgit v1.2.3