summaryrefslogtreecommitdiffstats
path: root/config/update_device_params.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-27 01:43:30 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-27 01:43:30 +0000
commit148d568b3db38ada9cf0c5085d2c71584d588598 (patch)
tree681681965b7089d49121356a367f39f01c661f05 /config/update_device_params.lua
parent24e737f23a7ef3a5f5871d75a23470d6ee27462e (diff)
downloadacf-provisioning-148d568b3db38ada9cf0c5085d2c71584d588598.tar.bz2
acf-provisioning-148d568b3db38ada9cf0c5085d2c71584d588598.tar.xz
Revert "Change function prototypes to pass self and use self.model instead of functions table"
This reverts commit fb00ff8f05dae3c110beceb929ea036e4cd14ae1. Conflicts: provisioning-model.lua Conflict was resolved by removing "mymodule." from function calls that are once again made local
Diffstat (limited to 'config/update_device_params.lua')
-rw-r--r--config/update_device_params.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/config/update_device_params.lua b/config/update_device_params.lua
index 775385c..c5ec144 100644
--- a/config/update_device_params.lua
+++ b/config/update_device_params.lua
@@ -1,17 +1,17 @@
-- This is the script run after editing device params
-local self, params, oldparams = ...
+local functions, params, oldparams = ...
posix = require("posix")
local root = "/var/www/provisioning/htdocs/"
---self.logevent("got to update_device_params script")
+--APP.logevent("got to update_device_params script")
local function findip(mac)
if not mac or mac == "" then
return nil
end
- local ipaddr = self.getselectresponse("SELECT ip FROM provisioning_requests WHERE mac~*'"..mac.."'")
+ local ipaddr = functions.getselectresponse("SELECT ip FROM provisioning_requests WHERE mac~*'"..mac.."'")
if ipaddr and ipaddr[1] then
return ipaddr[1].ip
end
@@ -20,10 +20,10 @@ end
local notify_device = function(mac, extension)
local ipaddr = findip(mac)
if ipaddr then
- --self.logevent("Notifying "..ipaddr.." to update for "..(mac or ""))
+ --APP.logevent("Notifying "..ipaddr.." to update for "..(mac or ""))
os.execute("/etc/provisioning/notify_device "..ipaddr.." "..extension)
else
- --self.logevent("Warning - could not find IP address for "..(mac or ""))
+ --APP.logevent("Warning - could not find IP address for "..(mac or ""))
end
end
@@ -34,10 +34,10 @@ if oldparams.value.device and oldparams.value.device.value.mac and oldparams.val
if string.match(oldparams.value.device.label, "Polycom") and string.match(oldparams.value.device.value.mac.value, "[1-9A-F]") then
local deletefiles = true
if string.match(params.value.device.value.mac.value, "[1-9A-F]") then
- --self.logevent("Moving files for "..oldparams.value.device.value.mac.value)
+ --APP.logevent("Moving files for "..oldparams.value.device.value.mac.value)
deletefiles = false
else
- --self.logevent("Deleting files for "..oldparams.value.device.value.mac.value)
+ --APP.logevent("Deleting files for "..oldparams.value.device.value.mac.value)
end
local path = root.."Polycom/"
if posix.stat(path, "type") == "directory" then
@@ -45,10 +45,10 @@ if oldparams.value.device and oldparams.value.device.value.mac and oldparams.val
if string.match(d, string.lower(oldparams.value.device.value.mac.value)) and posix.stat(path..d, "type") == "regular" then
local newfile = string.gsub(d, string.lower(oldparams.value.device.value.mac.value), string.lower(params.value.device.value.mac.value))
if deletefiles then
- --self.logevent("deleting "..path..d)
+ --APP.logevent("deleting "..path..d)
os.remove(path..d)
else
- --self.logevent("moving "..path..d.." to "..path..newfile)
+ --APP.logevent("moving "..path..d.." to "..path..newfile)
os.rename(path..d, path..newfile)
end
end