summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/upgrade.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-25 16:36:44 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-26 11:57:08 -0600
commit533cc583ed20efdfd6bee60f86d16fef3942898b (patch)
treeb89f9b0988d38e9995a71ff8d14ea023cc37783a /source4/scripting/python/samba/upgrade.py
parentcea31e32163fe639be72b3f4dfca1362c93b5576 (diff)
downloadsamba-533cc583ed20efdfd6bee60f86d16fef3942898b.tar.gz
samba-533cc583ed20efdfd6bee60f86d16fef3942898b.tar.xz
samba-533cc583ed20efdfd6bee60f86d16fef3942898b.zip
r26596: Fixed upgrade.py.
Added blackbox tests for provision and upgrade Python scripts. Clean up temporary files created by the Python tests. (This used to be commit 2227fb6df62240cae64d27a1920d878316f819fc)
Diffstat (limited to 'source4/scripting/python/samba/upgrade.py')
-rw-r--r--source4/scripting/python/samba/upgrade.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index c13351bc63..05a63d9326 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -8,7 +8,6 @@
"""Support code for upgrading from Samba 3 to Samba 4."""
from provision import findnss, provision
-import provision
import grp
import pwd
import uuid
@@ -255,7 +254,7 @@ maxVersion: %llu
return ldif
-def upgrade_provision(samba3, setup_dir, message, credentials, session_info, paths):
+def upgrade_provision(samba3, setup_dir, message, credentials, session_info, lp, paths):
oldconf = samba3.get_conf()
if oldconf.get("domain logons") == "True":
@@ -266,7 +265,11 @@ def upgrade_provision(samba3, setup_dir, message, credentials, session_info, pat
else:
serverrole = "member server"
+ lp.set("server role", serverrole)
domainname = oldconf.get("workgroup")
+ if domainname:
+ domainname = str(domainname)
+ lp.set("workgroup", domainname)
realm = oldconf.get("realm")
netbiosname = oldconf.get("netbios name")
@@ -279,18 +282,19 @@ def upgrade_provision(samba3, setup_dir, message, credentials, session_info, pat
if realm is None:
realm = domainname.lower()
message("No realm specified in smb.conf file, assuming '%s'\n" % realm)
+ lp.set("realm", realm)
domainguid = secrets_db.get_domain_guid(domainname)
- domainsid = secrets_db.get_sid(domainsid)
+ domainsid = secrets_db.get_sid(domainname)
if domainsid is None:
message("Can't find domain secrets for '%s'; using random SID\n" % domainname)
if netbiosname is not None:
machinepass = secrets_db.get_machine_password(netbiosname)
else:
- netbiosname = None
+ machinepass = None
- provision(lp, setup_dir, message, blank=True, paths=path, session_info=session_info,
+ provision(lp=lp, setup_dir=setup_dir, message=message, blank=True, ldapbackend=None, paths=paths, session_info=session_info,
credentials=credentials, realm=realm, domain=domainname,
domainsid=domainsid, domainguid=domainguid, machinepass=machinepass, serverrole=serverrole)
@@ -500,18 +504,6 @@ data: %d
return ret
-def upgrade_verify(subobj, samba3, paths, message):
- message("Verifying account policies")
-
- samldb = Ldb(paths.samdb)
-
- for account in samba3.samaccounts:
- msg = samldb.search("(&(sAMAccountName=" + account.nt_username + ")(objectclass=user))")
- assert(len(msg) >= 1)
-
- # FIXME
-
-
def enable_samba3sam(samdb):
samdb.modify("""