diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-09-23 18:13:03 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-09-23 18:13:03 +0000 |
commit | fb00ff8f05dae3c110beceb929ea036e4cd14ae1 (patch) | |
tree | 51d124ce1c65e3a600a7da7b9dd57ffafd83f910 /config/delete_device.lua | |
parent | 60ef6e20019e046aa801325d29893ada12b5d5af (diff) | |
download | acf-provisioning-fb00ff8f05dae3c110beceb929ea036e4cd14ae1.tar.bz2 acf-provisioning-fb00ff8f05dae3c110beceb929ea036e4cd14ae1.tar.xz |
Change function prototypes to pass self and use self.model instead of functions table
Changed the order of the first two parameters passed to validate function in provisioning_params
Replaced all APP references with self, now that self is available
Still need to implement swapvalidateparams script
Diffstat (limited to 'config/delete_device.lua')
-rw-r--r-- | config/delete_device.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/config/delete_device.lua b/config/delete_device.lua index 4f5fee7..81c2afb 100644 --- a/config/delete_device.lua +++ b/config/delete_device.lua @@ -1,20 +1,20 @@ -- This is the script run after deleting a device (and all of its params) -local functions, olddevice, oldparams = ... +local self, olddevice, oldparams = ... require("posix") local root = "/var/www/provisioning/htdocs/" ---APP.logevent("got to delete_device script") +--self.logevent("got to delete_device script") -- First, we delete the associated config files for Polycom with valid MAC (not blank or all 0's) if oldparams.value.device and string.match(oldparams.value.device.label, "Polycom") and oldparams.value.device.value.mac and string.match(oldparams.value.device.value.mac.value, "[1-9A-F]") then - --APP.logevent("Deleting files for "..oldparams.value.device.value.mac.value) + --self.logevent("Deleting files for "..oldparams.value.device.value.mac.value) local path = root.."Polycom/" if posix.stat(path, "type") == "directory" then for d in posix.files(path) do if string.match(d, string.lower(oldparams.value.device.value.mac.value)) and posix.stat(path..d, "type") == "regular" then - --APP.logevent("deleting "..path..d) + --self.logevent("deleting "..path..d) os.remove(path..d) end end @@ -56,5 +56,5 @@ setmetatable (env, {__index = _G}) -- so we set env 0, not env 1 setfenv (0, env) local f = loadfile("/etc/provisioning/update_device_params.lua") -if (f) then f(functions, params, oldparams) end +if (f) then f(self, params, oldparams) end setfenv (0, _G) |