summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-14 10:31:29 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-14 10:34:26 +0100
commit5e06110bc19bb4e72a57487bdb231856f2f0c303 (patch)
treea0ea2e1480f6fda6a845dea0be2ae2895e4bdc9f
parentb4826b9393244e46e855a65a65df67d9e6c1d81c (diff)
downloadsamba-5e06110bc19bb4e72a57487bdb231856f2f0c303.tar.gz
samba-5e06110bc19bb4e72a57487bdb231856f2f0c303.tar.bz2
samba-5e06110bc19bb4e72a57487bdb231856f2f0c303.zip
Reintroduce "s4:provision Improve the handling of provision errors""
This mainly reverts commit f0bc02d74c16bc013e9fdab46ef271cf45873453. Jelmer pointed out a way how we can achieve the same error handling with an older syntax also on Python 2.4+.
-rwxr-xr-xsource4/setup/provision41
1 files changed, 23 insertions, 18 deletions
diff --git a/source4/setup/provision b/source4/setup/provision
index 2bb6b87a03..a04bc2ae3f 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -37,6 +37,7 @@ from samba.auth import system_session
import samba.getopt as options
from samba.provision import provision, FILL_FULL, FILL_NT4SYNC, FILL_DRS, find_setup_dir
from samba import DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008, DS_DOMAIN_FUNCTION_2008_R2
+from samba.provisionexceptions import ProvisioningError
# how do we make this case insensitive??
@@ -225,21 +226,25 @@ elif opts.use_xattrs == "auto":
session = system_session()
-provision(setup_dir, message,
- session, creds, smbconf=smbconf, targetdir=opts.targetdir,
- samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
- domainguid=opts.domain_guid, domainsid=opts.domain_sid,
- policyguid=opts.policy_guid, policyguid_dc=opts.policy_guid_dc,
- hostname=opts.host_name,
- hostip=opts.host_ip, hostip6=opts.host_ip6,
- ntdsguid=opts.ntds_guid,
- invocationid=opts.invocationid, adminpass=opts.adminpass,
- krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
- dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody,
- wheel=opts.wheel, users=opts.users,
- serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
- ldap_backend_extra_port=opts.ldap_backend_extra_port,
- backend_type=opts.ldap_backend_type,
- ldapadminpass=opts.ldapadminpass, ol_mmr_urls=opts.ol_mmr_urls,
- slapd_path=opts.slapd_path, setup_ds_path=opts.setup_ds_path,
- nosync=opts.nosync,ldap_dryrun_mode=opts.ldap_dryrun_mode,useeadb=eadb)
+try:
+ provision(setup_dir, message,
+ session, creds, smbconf=smbconf, targetdir=opts.targetdir,
+ samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
+ domainguid=opts.domain_guid, domainsid=opts.domain_sid,
+ policyguid=opts.policy_guid, policyguid_dc=opts.policy_guid_dc,
+ hostname=opts.host_name,
+ hostip=opts.host_ip, hostip6=opts.host_ip6,
+ ntdsguid=opts.ntds_guid,
+ invocationid=opts.invocationid, adminpass=opts.adminpass,
+ krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
+ dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody,
+ wheel=opts.wheel, users=opts.users,
+ serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
+ ldap_backend_extra_port=opts.ldap_backend_extra_port,
+ backend_type=opts.ldap_backend_type,
+ ldapadminpass=opts.ldapadminpass, ol_mmr_urls=opts.ol_mmr_urls,
+ slapd_path=opts.slapd_path, setup_ds_path=opts.setup_ds_path,
+ nosync=opts.nosync,ldap_dryrun_mode=opts.ldap_dryrun_mode,useeadb=eadb)
+except ProvisioningError, e:
+ print str(e)
+ exit(1)