diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-12-15 16:41:37 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-12-18 14:27:43 +1100 |
commit | c3d1e5ca0c9f8d6c59a6fd4252a6e275b35e06de (patch) | |
tree | dce241bb31e051df8da71df37076b43c1262a673 /source4/scripting/python | |
parent | 0c1ff3bb09e3fec82c11fc182d6a5a12494caea8 (diff) | |
download | samba-c3d1e5ca0c9f8d6c59a6fd4252a6e275b35e06de.tar.gz samba-c3d1e5ca0c9f8d6c59a6fd4252a6e275b35e06de.tar.bz2 samba-c3d1e5ca0c9f8d6c59a6fd4252a6e275b35e06de.zip |
s4:provision Give a more useful error message in guess_names
The problem here is that as we start to get 'real users' they still
decide to do silly things, like load empty but existing smb.conf
files. Let's give them a better chance to discover what they did
wrong.
Andrew Bartlett
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/provision.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 44ccaa8ef0..3e4e90a746 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -359,12 +359,16 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, if dnsdomain is None: dnsdomain = lp.get("realm") - assert dnsdomain is not None + if dnsdomain is None or dnsdomain == "": + raise ProvisioningError("guess_names: 'realm' not specified in supplied smb.conf!") + dnsdomain = dnsdomain.lower() if serverrole is None: serverrole = lp.get("server role") - assert serverrole is not None + if serverrole is None: + raise ProvisioningError("guess_names: 'server role' not specified in supplied smb.conf!") + serverrole = serverrole.lower() realm = dnsdomain.upper() @@ -372,10 +376,14 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, if lp.get("realm").upper() != realm: raise ProvisioningError("guess_names: Realm '%s' in smb.conf must match chosen realm '%s'!", lp.get("realm").upper(), realm) + if lp.get("server role").lower() != serverrole: + raise ProvisioningError("guess_names: server role '%s' in smb.conf must match chosen server role '%s'!", lp.get("server role").upper(), serverrole) + if serverrole == "domain controller": if domain is None: domain = lp.get("workgroup") - assert domain is not None + if domain is None: + raise ProvisioningError("guess_names: 'workgroup' not specified in supplied smb.conf!") domain = domain.upper() if lp.get("workgroup").upper() != domain: |