diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-23 23:33:36 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-01-23 23:38:57 +0100 |
commit | decdf5954d5e1ae84318d6767317965f544a897f (patch) | |
tree | b2d0d55116726fae8a086511100c341b769e199c /source4/setup | |
parent | 00cb710fbc872cffa2d4d5c54c5ea65ba993da0c (diff) | |
download | samba-decdf5954d5e1ae84318d6767317965f544a897f.tar.gz samba-decdf5954d5e1ae84318d6767317965f544a897f.tar.xz samba-decdf5954d5e1ae84318d6767317965f544a897f.zip |
python: Add convenience function for getting command line loadparm context
and default to using system smb.conf.
(This used to be commit b3afde0f00ab5093b577b139a062c233d4db2524)
Diffstat (limited to 'source4/setup')
-rwxr-xr-x | source4/setup/provision.py | 9 | ||||
-rwxr-xr-x | source4/setup/upgrade.py | 9 | ||||
-rwxr-xr-x | source4/setup/vampire.py | 7 |
3 files changed, 11 insertions, 14 deletions
diff --git a/source4/setup/provision.py b/source4/setup/provision.py index 88015ce0a31..b9a11bdd78d 100755 --- a/source4/setup/provision.py +++ b/source4/setup/provision.py @@ -37,7 +37,8 @@ from samba.provision import (provision, provision_paths_from_lp) parser = optparse.OptionParser("provision [options]") -parser.add_option_group(options.SambaOptions(parser)) +sambaopts = options.SambaOptions(parser) +parser.add_option_group(sambaopts) parser.add_option_group(options.VersionOptions(parser)) credopts = options.CredentialsOptions(parser) parser.add_option_group(credopts) @@ -111,9 +112,7 @@ if opts.realm is None or opts.domain is None: sys.exit(1) # cope with an initially blank smb.conf -lp = param.LoadParm() -if opts.configfile: - lp.load(opts.configfile) +lp = sambaopts.get_loadparm() if opts.targetdir is not None: if not os.path.exists(opts.targetdir): os.mkdir(opts.targetdir) @@ -127,7 +126,7 @@ if opts.aci is not None: print "set ACI: %s" % opts.aci paths = provision_paths_from_lp(lp, opts.realm.lower()) -paths.smbconf = opts.configfile +paths.smbconf = sambaopts.get_loadparm_path() if opts.ldap_backend: if opts.ldap_backend == "ldapi": diff --git a/source4/setup/upgrade.py b/source4/setup/upgrade.py index ea6f83d7de6..4cf9641ef2a 100755 --- a/source4/setup/upgrade.py +++ b/source4/setup/upgrade.py @@ -14,7 +14,8 @@ import samba.getopt as options from auth import system_session parser = optparse.OptionParser("upgrade [options] <libdir> <smbconf>") -parser.add_option_group(options.SambaOptions(parser)) +sambaopts = options.SambaOptions(parser) +parser.add_option_group(sambaopts) parser.add_option_group(options.VersionOptions(parser)) credopts = options.CredentialsOptions(parser) parser.add_option_group(credopts) @@ -59,15 +60,13 @@ if setup_dir is None: setup_dir = "setup" creds = credopts.get_credentials() -lp = param.LoadParm() -if opts.configfile: - lp.load(opts.configfile) +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 = opts.configfile +paths.smbconf = sambaopts.get_loadparm_path() upgrade_provision(samba3, setup_dir, message, credentials=creds, session_info=system_session(), lp=lp, paths=paths) diff --git a/source4/setup/vampire.py b/source4/setup/vampire.py index 392cd2d4fb2..728c53146af 100755 --- a/source4/setup/vampire.py +++ b/source4/setup/vampire.py @@ -26,7 +26,8 @@ from auth import system_session import sys parser = optparse.OptionParser("vampire [options] <domain>") -parser.add_option_group(options.SambaOptions(parser)) +sambaopts = options.SambaOptions(parser) +parser.add_option_group(sambaopts) parser.add_option_group(options.VersionOptions(parser)) credopts = options.CredentialsOptions(parser) parser.add_option_group(credopts) @@ -47,8 +48,6 @@ def vampire(domain, session_info, credentials, lp): ctx.samsync_ldb(vampire_ctx, machine_creds=machine_creds, session_info=session_info) -lp = param.LoadParm() -if opts.configfile: - lp.load(opts.configfile) +lp = sambaopts.get_loadparm() vampire(args[0], session_info=system_session(), credentials=credopts.get_credentials(), lp=lp) |