Exception handling cleanup

git-svn-id: http://munki.googlecode.com/svn/trunk@364 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2009-11-18 05:53:11 +00:00
parent f712554195
commit 5a2bf9e3d8

View File

@@ -299,7 +299,7 @@ def ImportPackage(packagepath, c):
t = (pkgkey, pathkey, uid, gid, perms)
c.execute('INSERT INTO pkgs_paths (pkg_key, path_key, uid, gid, perms) values (?, ?, ?, ?, ?)', t)
except:
except sqlite3.DatabaseError:
pass
@@ -463,7 +463,7 @@ def initDatabase(packagedb,forcerebuild=False):
if os.path.exists(packagedb):
try:
os.remove(packagedb)
except Exception, e:
except (OSError, IOError), e:
munkicommon.display_error(
"Could not remove out-of-date receipt database.")
return False
@@ -838,14 +838,14 @@ def removeFilesystemItems(removalpaths, forcedeletebundles):
ds_storepath = pathtoremove + "/.DS_Store"
try:
os.remove(ds_storepath)
except:
except (OSError, IOError):
pass
diritems = os.listdir(pathtoremove)
if diritems == []:
# directory is empty
try:
os.rmdir(pathtoremove)
except Exception, err:
except (OSError, IOError), err:
msg = "Couldn't remove directory %s - %s" % \
(pathtoremove, err)
munkicommon.display_error(msg)
@@ -891,7 +891,7 @@ def removeFilesystemItems(removalpaths, forcedeletebundles):
retcode = ''
try:
os.remove(pathtoremove)
except Exception, err:
except (OSError, IOError), err:
msg = "Couldn't remove item %s: %s" % (pathtoremove, err)
munkicommon.display_error(msg)
removalerrors = removalerrors + "\n" + msg