diff options
author | Ted Trask <ttrask01@yahoo.com> | 2012-08-08 20:27:34 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-05-25 12:38:18 +0000 |
commit | 5ce322d9886082c9b75da409dbbd9aac97eeb1a0 (patch) | |
tree | d2d98a405aa012f497c03463f6eed373147d1fc2 /config/update_device_params.lua | |
parent | 65382272223922a0cc67a1e7e74610fbf0a980a1 (diff) | |
download | acf-provisioning-5ce322d9886082c9b75da409dbbd9aac97eeb1a0.tar.bz2 acf-provisioning-5ce322d9886082c9b75da409dbbd9aac97eeb1a0.tar.xz |
Modified scripts so no exception if Polycom path is missing
(cherry picked from commit 12a599b5e3ac719513bed698271cec060283b223)
Diffstat (limited to 'config/update_device_params.lua')
-rw-r--r-- | config/update_device_params.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/config/update_device_params.lua b/config/update_device_params.lua index 5d13099..61d33d2 100644 --- a/config/update_device_params.lua +++ b/config/update_device_params.lua @@ -33,11 +33,13 @@ oldparams = oldparams or {value={}} if oldparams.value.device and oldparams.value.device.value.mac and oldparams.value.device.value.mac.value ~= "" and params.value.device and params.value.device.value.mac and params.value.device.value.mac.value ~= oldparams.value.device.value.mac.value then if string.match(oldparams.value.device.label, "Polycom") then local path = root.."Polycom/" - 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 - local newfile = string.gsub(d, string.lower(oldparams.value.device.value.mac.value), string.lower(params.value.device.value.mac.value)) - APP.logevent("moving "..path..d.." to "..path..newfile) - os.rename(path..d, path..newfile) + 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 + local newfile = string.gsub(d, string.lower(oldparams.value.device.value.mac.value), string.lower(params.value.device.value.mac.value)) + APP.logevent("moving "..path..d.." to "..path..newfile) + os.rename(path..d, path..newfile) + end end end end |