Catch specific exceptions, rather than catching everything, which might hide other...
[kai/samba-autobuild/.git] / source4 / scripting / python / samba / provision.py
index d77b487512af76786e10609959cff79b2a621752..10daf1b2b92537d314f38138187aa1d9f195c41f 100644 (file)
@@ -454,7 +454,7 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
                       credentials=credentials, lp=lp)
         # Wipes the database
         samdb.erase()
-    except:
+    except LdbError:
         os.unlink(samdb_path)
         samdb = SamDB(samdb_path, session_info=session_info, 
                       credentials=credentials, lp=lp)
@@ -647,7 +647,7 @@ def setup_templatesdb(path, setup_path, session_info, credentials, lp):
     # Wipes the database
     try:
         templates_ldb.erase()
-    except:
+    except LdbError:
         os.unlink(path)
 
     templates_ldb.load_ldif_file_add(setup_path("provision_templates_init.ldif"))
@@ -1222,7 +1222,7 @@ def provision_backend(setup_dir=None, message=None,
     schemadb_path = os.path.join(paths.ldapdir, "schema-tmp.ldb")
     try:
         os.unlink(schemadb_path)
-    except:
+    except OSError:
         pass
 
     schemadb = Ldb(schemadb_path, lp=lp)