From 12a599b5e3ac719513bed698271cec060283b223 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 8 Aug 2012 20:27:34 +0000 Subject: Modified scripts so no exception if Polycom path is missing --- config/delete_device.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'config/delete_device.lua') diff --git a/config/delete_device.lua b/config/delete_device.lua index ea69da2..d7e34a1 100644 --- a/config/delete_device.lua +++ b/config/delete_device.lua @@ -10,10 +10,12 @@ APP.logevent("got to delete_device script") -- First, we delete the associated config files if oldparams.value.device and string.match(oldparams.value.device.label, "Polycom") and oldparams.value.device.value.mac 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 - APP.logevent("deleting "..path..d) - os.remove(path..d) + 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) + os.remove(path..d) + end end end end -- cgit v1.2.3