summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2009-11-05 21:55:34 -0600
committerAndrew Bartlett <abartlet@samba.org>2009-11-12 22:23:22 +1100
commit55bb60a5db559a06a05a1be6633d92b8f6555c08 (patch)
treefbc52489d6c39c8500ada450de17200d021cf0c8
parent1564067fbc8490bcef5523db1d7e997dca00f0bf (diff)
downloadsamba-55bb60a5db559a06a05a1be6633d92b8f6555c08.tar.gz
samba-55bb60a5db559a06a05a1be6633d92b8f6555c08.tar.bz2
samba-55bb60a5db559a06a05a1be6633d92b8f6555c08.zip
s4:provision - Added constructors for FDSBackend and OpenLDAPBackend.
-rw-r--r--source4/scripting/python/samba/provision.py27
-rw-r--r--source4/scripting/python/samba/provisionbackend.py111
2 files changed, 95 insertions, 43 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index f803f588eb..1726932d0a 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1239,13 +1239,13 @@ def provision(setup_dir, message, session_info,
lp=lp, credentials=credentials,
names=names,
message=message, hostname=hostname,
- root=root, schema=schema,
+ schema=schema,
ldapadminpass=ldapadminpass,
- ldap_backend_extra_port=ldap_backend_extra_port,
- ol_mmr_urls=ol_mmr_urls,
slapd_path=slapd_path,
- setup_ds_path=setup_ds_path,
+ ldap_backend_extra_port=ldap_backend_extra_port,
ldap_dryrun_mode=ldap_dryrun_mode,
+ root=root,
+ setup_ds_path=setup_ds_path,
domainsid=domainsid)
elif backend_type == "openldap":
provision_backend = OpenLDAPBackend(backend_type,
@@ -1253,28 +1253,19 @@ def provision(setup_dir, message, session_info,
lp=lp, credentials=credentials,
names=names,
message=message, hostname=hostname,
- root=root, schema=schema,
+ schema=schema,
ldapadminpass=ldapadminpass,
- ldap_backend_extra_port=ldap_backend_extra_port,
- ol_mmr_urls=ol_mmr_urls,
slapd_path=slapd_path,
- setup_ds_path=setup_ds_path,
+ ldap_backend_extra_port=ldap_backend_extra_port,
ldap_dryrun_mode=ldap_dryrun_mode,
- domainsid=domainsid)
+ ol_mmr_urls=ol_mmr_urls,
+ nosync=nosync)
elif backend_type == "ldb" or backend_type == "existing":
provision_backend = ProvisionBackend(backend_type,
paths=paths, setup_path=setup_path,
lp=lp, credentials=credentials,
names=names,
- message=message, hostname=hostname,
- root=root, schema=schema,
- ldapadminpass=ldapadminpass,
- ldap_backend_extra_port=ldap_backend_extra_port,
- ol_mmr_urls=ol_mmr_urls,
- slapd_path=slapd_path,
- setup_ds_path=setup_ds_path,
- ldap_dryrun_mode=ldap_dryrun_mode,
- domainsid=domainsid)
+ message=message)
else:
raise ProvisioningError("Unknown LDAP backend type selected")
diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py
index da17cbf05c..dfadac1e1b 100644
--- a/source4/scripting/python/samba/provisionbackend.py
+++ b/source4/scripting/python/samba/provisionbackend.py
@@ -56,36 +56,13 @@ def setup_db_config(setup_path, dbdir):
class ProvisionBackend(object):
def __init__(self, backend_type, paths=None, setup_path=None, lp=None, credentials=None,
- names=None, message=None,
- hostname=None, root=None,
- schema=None, ldapadminpass=None,
- ldap_backend_extra_port=None,
- ol_mmr_urls=None,
- setup_ds_path=None, slapd_path=None,
- nosync=False, ldap_dryrun_mode=False,
- domainsid=None):
- """Provision an LDAP backend for samba4
-
- This works for OpenLDAP and Fedora DS
- """
+ names=None, message=None):
+ """Provision a backend for samba4"""
self.paths = paths
self.setup_path = setup_path
- self.slapd_command = None
- self.slapd_command_escaped = None
self.lp = lp
self.names = names
self.message = message
- self.hostname = hostname
- self.root = root
- self.schema = schema
- self.ldapadminpass = ldapadminpass
- self.ldap_backend_extra_port = ldap_backend_extra_port
- self.ol_mmr_urls = ol_mmr_urls
- self.setup_ds_path = setup_ds_path
- self.slapd_path = slapd_path
- self.nosync = nosync
- self.ldap_dryrun_mode = ldap_dryrun_mode
- self.domainsid = domainsid
self.type = backend_type
@@ -130,6 +107,34 @@ class ProvisionBackend(object):
class LDAPBackend(ProvisionBackend):
+ def __init__(self, backend_type, paths=None, setup_path=None, lp=None, credentials=None,
+ names=None, message=None,
+ hostname=None,
+ schema=None,
+ ldapadminpass=None,
+ slapd_path=None,
+ ldap_backend_extra_port=None,
+ ldap_dryrun_mode=False):
+
+ super(LDAPBackend, self).__init__(
+ backend_type=backend_type,
+ paths=paths, setup_path=setup_path,
+ lp=lp, credentials=credentials,
+ names=names,
+ message=message)
+
+ self.hostname = hostname
+ self.schema = schema
+
+ self.ldapadminpass = ldapadminpass
+
+ self.slapd_path = slapd_path
+ self.slapd_command = None
+ self.slapd_command_escaped = None
+
+ self.ldap_backend_extra_port = ldap_backend_extra_port
+ self.ldap_dryrun_mode = ldap_dryrun_mode
+
def setup(self):
# we will shortly start slapd with ldapi for final provisioning. first check with ldapsearch -> rootDSE via self.ldapi_uri
# if another instance of slapd is already running
@@ -230,6 +235,33 @@ class LDAPBackend(ProvisionBackend):
class OpenLDAPBackend(LDAPBackend):
+ def __init__(self, backend_type, paths=None, setup_path=None, lp=None, credentials=None,
+ names=None, message=None,
+ hostname=None,
+ schema=None,
+ ldapadminpass=None,
+ slapd_path=None,
+ ldap_backend_extra_port=None,
+ ldap_dryrun_mode=False,
+ ol_mmr_urls=None,
+ nosync=False):
+
+ super(OpenLDAPBackend, self).__init__(
+ backend_type=backend_type,
+ paths=paths, setup_path=setup_path,
+ lp=lp, credentials=credentials,
+ names=names,
+ message=message,
+ hostname=hostname,
+ schema=schema,
+ ldapadminpass=ldapadminpass,
+ slapd_path=slapd_path,
+ ldap_backend_extra_port=ldap_backend_extra_port,
+ ldap_dryrun_mode=ldap_dryrun_mode)
+
+ self.ol_mmr_urls = ol_mmr_urls
+ self.nosync = nosync
+
def provision(self):
# Wipe the directories so we can start
shutil.rmtree(os.path.join(self.paths.ldapdir, "db"), True)
@@ -455,6 +487,35 @@ class OpenLDAPBackend(LDAPBackend):
class FDSBackend(LDAPBackend):
+ def __init__(self, backend_type, paths=None, setup_path=None, lp=None, credentials=None,
+ names=None, message=None,
+ hostname=None,
+ schema=None,
+ ldapadminpass=None,
+ slapd_path=None,
+ ldap_backend_extra_port=None,
+ ldap_dryrun_mode=False,
+ root=None,
+ setup_ds_path=None,
+ domainsid=None):
+
+ super(FDSBackend, self).__init__(
+ backend_type=backend_type,
+ paths=paths, setup_path=setup_path,
+ lp=lp, credentials=credentials,
+ names=names,
+ message=message,
+ hostname=hostname,
+ schema=schema,
+ ldapadminpass=ldapadminpass,
+ slapd_path=slapd_path,
+ ldap_backend_extra_port=ldap_backend_extra_port,
+ ldap_dryrun_mode=ldap_dryrun_mode)
+
+ self.root = root
+ self.setup_ds_path = setup_ds_path
+ self.domainsid = domainsid
+
def provision(self):
if self.ldap_backend_extra_port is not None:
serverport = "ServerPort=%d" % self.ldap_backend_extra_port