From 2f19efb668330ae932333cdb78bfc18dbb11fe5b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 28 Dec 2015 16:38:17 +0000 Subject: Better error reporting for editgroup/param when succeeded but setting device params failed --- provisioning-model.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'provisioning-model.lua') diff --git a/provisioning-model.lua b/provisioning-model.lua index 807d08e..fd4c1e4 100644 --- a/provisioning-model.lua +++ b/provisioning-model.lua @@ -1257,11 +1257,16 @@ mymodule.update_group = function(self, group, action, create) -- Update the devices after databasedisconnect so device failure doesn't rollback the change if success then + group.descr = {"Parameter Group Saved"} -- Notify the devices that their params might have changed (this will also validate) for i,d in ipairs(devices) do local r = set_device_params(get_device_params(d.device_id, false), false) - if r.errtxt then self.logevent("ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt()) end + if r.errtxt then + group.descr[#group.descr+1] = "ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt() + self.logevent(group.descr[#group.descr]) + end end + group.descr = table.concat(group.descr, "\n") end end) if not res and err then @@ -1442,11 +1447,16 @@ mymodule.update_param = function(self, param, action, create) -- Update the devices after databasedisconnect so device failure doesn't rollback the change if success then + param.descr = {"Parameter Saved"} -- Notify the devices that their params might have changed (this will also validate) for i,d in ipairs(devices) do local r = set_device_params(get_device_params(d.device_id, false), false) - if r.errtxt then self.logevent("ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt()) end + if r.errtxt then + param.descr[#param.descr+1] = "ERROR: Failed to update params for device "..d.device_id.."\n"..r:print_errtxt() + self.logevent(param.descr[#param.descr]) + end end + param.descr = table.concat(param.descr, "\n") end end) if not res and err then -- cgit v1.2.3