summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/join.py4
-rw-r--r--source4/scripting/python/samba/netcmd/dbcheck.py2
-rw-r--r--source4/scripting/python/samba/provision/__init__.py38
-rw-r--r--source4/scripting/python/samba/provision/common.py2
-rw-r--r--source4/scripting/python/samba/provision/sambadns.py4
-rw-r--r--source4/scripting/python/samba/samdb.py14
-rw-r--r--source4/scripting/python/samba/schema.py2
7 files changed, 34 insertions, 32 deletions
diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py
index b695277db3..10f8ad7e58 100644
--- a/source4/scripting/python/samba/join.py
+++ b/source4/scripting/python/samba/join.py
@@ -701,7 +701,7 @@ class dc_join(object):
ctx.destination_dsa_guid = destination_dsa_guid
print "Committing SAM database"
- except Exception:
+ except:
ctx.local_samdb.transaction_cancel()
raise
else:
@@ -877,7 +877,7 @@ class dc_join(object):
ctx.join_provision_own_domain()
ctx.join_setup_trusts()
ctx.join_finalise()
- except Exception:
+ except:
print "Join failed - cleaning up"
ctx.cleanup_old_join()
raise
diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py
index 72b2f9189a..db02c6a23d 100644
--- a/source4/scripting/python/samba/netcmd/dbcheck.py
+++ b/source4/scripting/python/samba/netcmd/dbcheck.py
@@ -117,7 +117,7 @@ class cmd_dbcheck(Command):
else:
error_count = chk.check_database(DN=DN, scope=search_scope,
controls=controls, attrs=attrs)
- except Exception:
+ except:
if started_transaction:
samdb.transaction_cancel()
raise
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index dccf77a5b0..aa8736bb3d 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -718,7 +718,7 @@ def setup_samdb_partitions(samdb_path, logger, lp, session_info,
logger.info("Setting up sam.ldb rootDSE")
setup_samdb_rootdse(samdb, names)
- except Exception:
+ except:
samdb.transaction_cancel()
raise
else:
@@ -860,7 +860,7 @@ def setup_secretsdb(paths, session_info, backend_credentials, lp):
"LDAPADMINREALM": backend_credentials.get_realm(),
"LDAPADMINPASS_B64": b64encode(backend_credentials.get_password())
})
- except Exception:
+ except:
secrets_ldb.transaction_cancel()
raise
return secrets_ldb
@@ -1200,7 +1200,7 @@ def fill_samdb(samdb, lp, names,
msg["subRefs"] = ldb.MessageElement(names.configdn , ldb.FLAG_MOD_ADD,
"subRefs")
- except Exception:
+ except:
samdb.transaction_cancel()
raise
else:
@@ -1285,22 +1285,23 @@ def fill_samdb(samdb, lp, names,
})
logger.info("Setting up self join")
- setup_self_join(samdb, admin_session_info, names=names, fill=fill, invocationid=invocationid,
- dnspass=dnspass,
- machinepass=machinepass,
- domainsid=domainsid,
- next_rid=next_rid,
- dc_rid=dc_rid,
- policyguid=policyguid,
- policyguid_dc=policyguid_dc,
- domainControllerFunctionality=domainControllerFunctionality,
- ntdsguid=ntdsguid)
+ setup_self_join(samdb, admin_session_info, names=names, fill=fill,
+ invocationid=invocationid,
+ dnspass=dnspass,
+ machinepass=machinepass,
+ domainsid=domainsid,
+ next_rid=next_rid,
+ dc_rid=dc_rid,
+ policyguid=policyguid,
+ policyguid_dc=policyguid_dc,
+ domainControllerFunctionality=domainControllerFunctionality,
+ ntdsguid=ntdsguid)
ntds_dn = "CN=NTDS Settings,%s" % names.serverdn
names.ntdsguid = samdb.searchone(basedn=ntds_dn,
attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE)
assert isinstance(names.ntdsguid, str)
- except Exception:
+ except:
samdb.transaction_cancel()
raise
else:
@@ -1771,7 +1772,7 @@ def provision(logger, session_info, credentials, smbconf=None,
create_phpldapadmin_config(paths.phpldapadminconfig,
ldapi_url)
- except Exception:
+ except:
secrets_ldb.transaction_cancel()
raise
@@ -1832,9 +1833,9 @@ def provision_become_dc(smbconf=None, targetdir=None,
serverdn=None, domain=None, hostname=None, domainsid=None,
adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None,
policyguid_dc=None, invocationid=None, machinepass=None, dnspass=None,
- dns_backend=None, root=None, nobody=None, users=None, wheel=None, backup=None,
- serverrole=None, ldap_backend=None, ldap_backend_type=None,
- sitename=None, debuglevel=1):
+ dns_backend=None, root=None, nobody=None, users=None, wheel=None,
+ backup=None, serverrole=None, ldap_backend=None,
+ ldap_backend_type=None, sitename=None, debuglevel=1):
logger = logging.getLogger("provision")
samba.set_debug_level(debuglevel)
@@ -1887,6 +1888,7 @@ class ProvisioningError(Exception):
class InvalidNetbiosName(Exception):
"""A specified name was not a valid NetBIOS name."""
+
def __init__(self, name):
super(InvalidNetbiosName, self).__init__(
"The name '%r' is not a valid NetBIOS name" % name)
diff --git a/source4/scripting/python/samba/provision/common.py b/source4/scripting/python/samba/provision/common.py
index 04bdb0f3c3..e9bcdf5f09 100644
--- a/source4/scripting/python/samba/provision/common.py
+++ b/source4/scripting/python/samba/provision/common.py
@@ -77,7 +77,7 @@ def setup_ldb(ldb, ldif_path, subst_vars):
ldb.transaction_start()
try:
setup_add_ldif(ldb, ldif_path, subst_vars)
- except Exception:
+ except:
ldb.transaction_cancel()
raise
else:
diff --git a/source4/scripting/python/samba/provision/sambadns.py b/source4/scripting/python/samba/provision/sambadns.py
index 2aefe4dae0..ae8515689b 100644
--- a/source4/scripting/python/samba/provision/sambadns.py
+++ b/source4/scripting/python/samba/provision/sambadns.py
@@ -715,7 +715,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
"DOMAINSID" : str(domainsid),
"DESCRIPTOR" : descr})
setup_add_ldif(dom_ldb, setup_path("provision_basedn_options.ldif"), None)
- except Exception:
+ except:
logger.error("Failed to setup database for BIND, AD based DNS cannot be used")
raise
del partfile[domaindn]
@@ -750,7 +750,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
tdb_copy(logger,
os.path.join(private_dir, pfile),
os.path.join(dns_dir, pfile))
- except Exception:
+ except:
logger.error("Failed to setup database for BIND, AD based DNS cannot be used")
raise
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 98c36bf38b..4c24989a21 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -222,7 +222,7 @@ pwdLastSet: 0
raise Exception('Unable to find group "%s"' % groupname)
assert(len(targetgroup) == 1)
self.delete(targetgroup[0].dn)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -280,7 +280,7 @@ member: %s
if modified is True:
self.modify_ldif(addtargettogroup)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -406,7 +406,7 @@ member: %s
if setpassword:
self.setpassword("(samAccountName=%s)" % ldb.binary_encode(username), password,
force_password_change_at_next_login_req)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -428,7 +428,7 @@ member: %s
raise Exception('Unable to find user "%s"' % username)
assert(len(target) == 1)
self.delete(target[0].dn)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -468,7 +468,7 @@ unicodePwd:: %s
# modify the userAccountControl to remove the disabled bit
self.enable_account(search_filter)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -511,7 +511,7 @@ accountExpires: %u
""" % (user_dn, userAccountControl, accountExpires)
self.modify_ldif(setexp)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
@@ -841,7 +841,7 @@ accountExpires: %u
self.transaction_start()
try:
seq = super(SamDB, self).sequence_number(seq_type)
- except Exception:
+ except:
self.transaction_cancel()
raise
else:
diff --git a/source4/scripting/python/samba/schema.py b/source4/scripting/python/samba/schema.py
index 9cbfa3a8e8..25ffa317a0 100644
--- a/source4/scripting/python/samba/schema.py
+++ b/source4/scripting/python/samba/schema.py
@@ -137,7 +137,7 @@ dn: @INDEXLIST
self.ldb.add_ldif(self.schema_dn_add)
self.ldb.modify_ldif(self.schema_dn_modify)
self.ldb.add_ldif(self.schema_data)
- except Exception:
+ except:
self.ldb.transaction_cancel()
raise
else: