summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-03-11 14:49:34 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-11 15:28:53 +1100
commit027123199e13cc02ae4edadd8f0dd0f0660e1193 (patch)
treec6c49eae8fb1bececb74992948ea3463918a1096 /source4/setup
parent59545276f2bd6df8ee5e75e96e707fd86ff44350 (diff)
downloadsamba-027123199e13cc02ae4edadd8f0dd0f0660e1193.tar.gz
samba-027123199e13cc02ae4edadd8f0dd0f0660e1193.tar.bz2
samba-027123199e13cc02ae4edadd8f0dd0f0660e1193.zip
s4:provision Improve the handling of provision errors
The backtraces were too confusing for our users, and didn't tell them what to do to fix the problem. By printing the string (rather than a backtrace), and including in the error what to do, and what file to remove, we give them a chance. Andrew Bartlett
Diffstat (limited to 'source4/setup')
-rwxr-xr-xsource4/setup/provision43
1 files changed, 25 insertions, 18 deletions
diff --git a/source4/setup/provision b/source4/setup/provision
index 2b31c4cd56..66aab7ea62 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,27 @@ 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 as e:
+ print str(e)
+ exit(1)
+
+