diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-11-11 10:45:13 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-11-11 02:57:04 +0000 |
commit | 81c9b98ecd6b0b4ec412ea7a0963002dc17f4f66 (patch) | |
tree | f14941c8d1df3cf6f3c57efd3dbee6c74565aed2 | |
parent | 1d7d09a8f72a9f7f888538b7f7c63969407e9c2d (diff) | |
download | samba-81c9b98ecd6b0b4ec412ea7a0963002dc17f4f66.tar.gz samba-81c9b98ecd6b0b4ec412ea7a0963002dc17f4f66.tar.bz2 samba-81c9b98ecd6b0b4ec412ea7a0963002dc17f4f66.zip |
s4-join: use the command line loadparm in provision during a join
this allows a join with an empty smb.conf to override locations of
files correctly with --option
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/scripting/python/samba/join.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision.py | 20 |
2 files changed, 13 insertions, 9 deletions
diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index 571b822f50..bdd63db718 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -412,7 +412,7 @@ class dc_join: serverdn=ctx.server_dn, domain=ctx.domain_name, hostname=ctx.myname, domainsid=ctx.domsid, machinepass=ctx.acct_pass, serverrole="domain controller", - sitename=ctx.site) + sitename=ctx.site, lp=ctx.lp) print "Provision OK for domain DN %s" % presult.domaindn ctx.local_samdb = presult.samdb ctx.lp = presult.lp diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 85d883f9ae..865fbaf6bc 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -83,13 +83,13 @@ def find_setup_dir(): if in_source_tree(): # In source tree dirname = os.path.dirname(__file__) - return os.path.join(dirname, "../../../setup") + return os.path.normpath(os.path.join(dirname, "../../../setup")) else: import sys for prefix in [sys.prefix, os.path.join(os.path.dirname(__file__), "../../../..")]: for suffix in ["share/setup", "share/samba/setup", "setup"]: - ret = os.path.join(prefix, suffix) + ret = os.path.normpath(os.path.join(prefix, suffix)) if os.path.isdir(ret): return ret raise Exception("Unable to find setup directory.") @@ -548,7 +548,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, def make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrole, - targetdir, sid_generator="internal", eadb=False): + targetdir, sid_generator="internal", eadb=False, default_lp=None): """Create a new smb.conf file based on a couple of basic settings. """ assert smbconf is not None @@ -585,7 +585,8 @@ def make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrole, assert realm is not None realm = realm.upper() - default_lp = samba.param.LoadParm() + if default_lp is None: + default_lp = samba.param.LoadParm() #Load non-existant file if os.path.exists(smbconf): default_lp.load(smbconf) @@ -1374,7 +1375,8 @@ def provision(setup_dir, logger, session_info, sitename=None, ol_mmr_urls=None, ol_olc=None, setup_ds_path=None, slapd_path=None, nosync=False, - ldap_dryrun_mode=False, useeadb=False, am_rodc=False): + ldap_dryrun_mode=False, useeadb=False, am_rodc=False, + lp=None): """Provision samba4 :note: caution, this wipes all existing data! @@ -1446,12 +1448,14 @@ def provision(setup_dir, logger, session_info, data = data.lstrip() if data is None or data == "": make_smbconf(smbconf, setup_path, hostname, domain, realm, - serverrole, targetdir, sid_generator, useeadb) + serverrole, targetdir, sid_generator, useeadb, + default_lp=lp) else: make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrole, - targetdir, sid_generator, useeadb) + targetdir, sid_generator, useeadb, default_lp=lp) - lp = samba.param.LoadParm() + if lp is None: + lp = samba.param.LoadParm() lp.load(smbconf) names = guess_names(lp=lp, hostname=hostname, domain=domain, dnsdomain=realm, serverrole=serverrole, |