summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-09 03:09:56 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-09 03:09:56 +0100
commitbd0bfe683386f983318b507c5a614f818cdfb38d (patch)
tree28aa616f000a8c9cb033e421929ee6574a8ae97d /source4
parent2aac2a5df8a03a42ed92e84f093b8aa5ba16dd1d (diff)
downloadsamba-bd0bfe683386f983318b507c5a614f818cdfb38d.tar.gz
samba-bd0bfe683386f983318b507c5a614f818cdfb38d.tar.bz2
samba-bd0bfe683386f983318b507c5a614f818cdfb38d.zip
Fix provision python test.
(This used to be commit b173fa6bd2b24b5a3e7b4fbcb926f6c9771c10ba)
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/provision.py24
-rwxr-xr-xsource4/setup/provision.py9
-rwxr-xr-xsource4/setup/upgrade.py1
3 files changed, 12 insertions, 22 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index b094581fb4..7dd564fae1 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -189,20 +189,16 @@ def setup_file(template, fname, substvars):
open(f, 'w').write(data)
-def provision_paths_from_lp(lp, dnsdomain, private_dir=None):
+def provision_paths_from_lp(lp, dnsdomain):
"""Set the default paths for provisioning.
:param lp: Loadparm context.
:param dnsdomain: DNS Domain name
"""
paths = ProvisionPaths()
- if private_dir is None:
- private_dir = lp.get("private dir")
- paths.keytab = "secrets.keytab"
- paths.dns_keytab = "dns.keytab"
- else:
- paths.keytab = os.path.join(private_dir, "secrets.keytab")
- paths.dns_keytab = os.path.join(private_dir, "dns.keytab")
+ private_dir = lp.get("private dir")
+ paths.keytab = "secrets.keytab"
+ paths.dns_keytab = "dns.keytab"
paths.shareconf = os.path.join(private_dir, "share.ldb")
paths.samdb = os.path.join(private_dir, lp.get("sam database") or "samdb.ldb")
@@ -469,7 +465,6 @@ def setup_registry(path, setup_path, session_info, credentials, lp):
:param lp: Loadparm context
"""
reg = registry.Registry()
- print path
hive = registry.open_ldb(path, session_info=session_info,
credentials=credentials, lp_ctx=lp)
reg.mount_hive(hive, "HKEY_LOCAL_MACHINE")
@@ -540,6 +535,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
serverrole, ldap_backend=None, ldap_backend_type=None):
"""Setup a complete SAM Database.
+ :note: This will wipe the main SAM database file!
"""
# Also wipes the database
@@ -745,6 +741,7 @@ def provision(lp, setup_dir, message, paths, session_info,
aci = "# no aci for local ldb"
if serverrole is None:
serverrole = lp.get("server role")
+ assert serverrole in ("domain controller", "member server")
if invocationid is None and serverrole == "domain controller":
invocationid = uuid.random()
@@ -774,9 +771,9 @@ def provision(lp, setup_dir, message, paths, session_info,
if not valid_netbios_name(netbiosname):
raise InvalidNetbiosName(netbiosname)
- dnsdomain = realm.lower()
+ dnsdomain = realm.lower()
if serverrole == "domain controller":
- domaindn = "DC=" + dnsdomain.replace(".", ",DC=")
+ domaindn = "DC=" + dnsdomain.replace(".", ",DC=")
if domain is None:
domain = lp.get("workgroup")
@@ -788,7 +785,6 @@ def provision(lp, setup_dir, message, paths, session_info,
domain = domain.upper()
if not valid_netbios_name(domain):
raise InvalidNetbiosName(domain)
-
else:
domaindn = "CN=" + netbiosname
domain = netbiosname
@@ -812,8 +808,6 @@ def provision(lp, setup_dir, message, paths, session_info,
smbconfsuffix = "dc"
elif serverrole == "member":
smbconfsuffix = "member"
- else:
- assert "Invalid server role setting: %s" % serverrole
setup_file(setup_path("provision.smb.conf.%s" % smbconfsuffix),
paths.smbconf, {
"HOSTNAME": hostname,
@@ -953,7 +947,7 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn,
def load_schema(setup_path, samdb, schemadn, netbiosname, configdn):
- """Load schema.
+ """Load schema for the SamDB.
:param samdb: Load a schema into a SamDB.
:param setup_path: Setup path function.
diff --git a/source4/setup/provision.py b/source4/setup/provision.py
index 9f887e8b3b..033d2491f2 100755
--- a/source4/setup/provision.py
+++ b/source4/setup/provision.py
@@ -26,9 +26,6 @@ import getopt
import optparse
import os, sys
-# Add path to the library for in-tree use
-sys.path.append("scripting/python")
-
import samba
from auth import system_session
@@ -130,12 +127,12 @@ lp.set("realm", opts.realm)
lp.set("workgroup", opts.domain)
lp.set("server role", opts.server_role or "domain controller")
-
if opts.aci is not None:
print "set ACI: %s" % opts.aci
-paths = provision_paths_from_lp(lp, opts.realm.lower(), private_dir)
-paths.smbconf = sambaopts.get_loadparm_path()
+paths = provision_paths_from_lp(lp, opts.realm.lower())
+if sambaopts.get_loadparm_path() is not None:
+ paths.smbconf = sambaopts.get_loadparm_path()
creds = credopts.get_credentials()
diff --git a/source4/setup/upgrade.py b/source4/setup/upgrade.py
index 4cf9641ef2..960cd1b9e2 100755
--- a/source4/setup/upgrade.py
+++ b/source4/setup/upgrade.py
@@ -7,7 +7,6 @@
import getopt
import optparse
import os, sys
-sys.path.append("scripting/python")
import param
import samba
import samba.getopt as options