Added exception handling for case where we invoke os.makedirs() on missing destination_path

This commit is contained in:
Timothy Sutton
2012-08-10 13:53:45 -04:00
parent fad5ea741a
commit d1be50ea42
+10 -1
View File
@@ -383,7 +383,16 @@ def copyItemsFromMountpoint(mountpoint, itemlist):
parent_mode = stat.S_IMODE(parent_stat.st_mode)
# make the new tree with the parent's mode
os.makedirs(destpath, mode=parent_mode)
try:
os.makedirs(destpath, mode=parent_mode)
except IOError:
munkicommon.display_error(
"There was an IO error in creating the path %s!" % destpath)
return -1
except:
munkicommon.display_error(
"There was an unknown error in creating the path %s!" % destpath)
return -1
# chown each new dir
for new_path in new_paths: