mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
Try to fix up part of the upgrade test.
There are still problems with the upgrade test, but these are not related to the provision system. Andrew Bartlett
This commit is contained in:
parent
0923de1228
commit
d331bc400f
@ -68,6 +68,12 @@ class ProvisionPaths:
|
||||
self.winsdb = None
|
||||
self.private_dir = None
|
||||
|
||||
class ProvisionResult:
|
||||
def __init__(self):
|
||||
self.paths = None
|
||||
self.domaindn = None
|
||||
self.lp = None
|
||||
self.samdb = None
|
||||
|
||||
def check_install(lp, session_info, credentials):
|
||||
"""Check whether the current install seems ok.
|
||||
@ -991,7 +997,12 @@ def provision(setup_dir, message, session_info,
|
||||
|
||||
message("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php" % paths.phpldapadminconfig)
|
||||
|
||||
return domaindn
|
||||
result = ProvisionResult()
|
||||
result.domaindn = domaindn
|
||||
result.paths = paths
|
||||
result.lp = lp
|
||||
result.samdb = samdb
|
||||
return result
|
||||
|
||||
def provision_become_dc(setup_dir=None,
|
||||
smbconf=None, targetdir=None, realm=None,
|
||||
|
@ -207,7 +207,7 @@ def import_wins(samba4_winsdb, samba3_winsdb):
|
||||
"objectClass": "winsMaxVersion",
|
||||
"maxVersion": str(version_id)})
|
||||
|
||||
def upgrade_provision(samba3, setup_dir, message, credentials, session_info, lp, paths):
|
||||
def upgrade_provision(samba3, setup_dir, message, credentials, session_info, smbconf, targetdir):
|
||||
oldconf = samba3.get_conf()
|
||||
|
||||
if oldconf.get("domain logons") == "True":
|
||||
@ -244,15 +244,13 @@ def upgrade_provision(samba3, setup_dir, message, credentials, session_info, lp,
|
||||
else:
|
||||
machinepass = None
|
||||
|
||||
domaindn = provision(setup_dir=setup_dir, message=message,
|
||||
samdb_fill=FILL_DRS, paths=paths, session_info=session_info,
|
||||
credentials=credentials, realm=realm,
|
||||
domain=domainname, domainsid=domainsid, domainguid=domainguid,
|
||||
machinepass=machinepass, serverrole=serverrole)
|
||||
result = provision(setup_dir=setup_dir, message=message,
|
||||
samdb_fill=FILL_DRS, smbconf=smbconf, session_info=session_info,
|
||||
credentials=credentials, realm=realm,
|
||||
domain=domainname, domainsid=domainsid, domainguid=domainguid,
|
||||
machinepass=machinepass, serverrole=serverrole, targetdir=targetdir)
|
||||
|
||||
samdb = SamDB(paths.samdb, credentials=credentials, lp=lp, session_info=session_info)
|
||||
|
||||
import_wins(Ldb(paths.winsdb), samba3.get_wins_db())
|
||||
import_wins(Ldb(result.paths.winsdb), samba3.get_wins_db())
|
||||
|
||||
# FIXME: import_registry(registry.Registry(), samba3.get_registry())
|
||||
|
||||
@ -268,12 +266,12 @@ def upgrade_provision(samba3, setup_dir, message, credentials, session_info, lp,
|
||||
passdb = samba3.get_sam_db()
|
||||
for name in passdb:
|
||||
user = passdb[name]
|
||||
#FIXME: import_sam_account(samdb, user, domaindn, domainsid)
|
||||
#FIXME: import_sam_account(result.samdb, user, domaindn, domainsid)
|
||||
|
||||
if hasattr(passdb, 'ldap_url'):
|
||||
message("Enabling Samba3 LDAP mappings for SAM database")
|
||||
|
||||
enable_samba3sam(samdb, passdb.ldap_url)
|
||||
enable_samba3sam(result.samdb, passdb.ldap_url)
|
||||
|
||||
|
||||
def enable_samba3sam(samdb, ldapurl):
|
||||
|
@ -50,7 +50,6 @@ else:
|
||||
samba3 = Samba3(libdir, smbconf)
|
||||
|
||||
from samba.upgrade import upgrade_provision
|
||||
from samba.provision import provision_paths_from_lp
|
||||
|
||||
message("Provisioning\n")
|
||||
|
||||
@ -59,13 +58,6 @@ if setup_dir is None:
|
||||
setup_dir = "setup"
|
||||
|
||||
creds = credopts.get_credentials()
|
||||
lp = sambaopts.get_loadparm()
|
||||
if opts.targetdir is not None:
|
||||
if not os.path.exists(opts.targetdir):
|
||||
os.mkdir(opts.targetdir)
|
||||
lp.set("private dir", os.path.abspath(opts.targetdir))
|
||||
lp.set("lock dir", os.path.abspath(opts.targetdir))
|
||||
paths = provision_paths_from_lp(lp, "")
|
||||
paths.smbconf = sambaopts.get_loadparm_path()
|
||||
|
||||
upgrade_provision(samba3, setup_dir, message, credentials=creds, session_info=system_session(),
|
||||
lp=lp, paths=paths)
|
||||
smbconf=sambaopts.get_loadparm_path(), targetdir=opts.targetdir)
|
||||
|
Loading…
Reference in New Issue
Block a user