summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-01-29 03:24:20 -0600
committerAndrew Bartlett <abartlet@samba.org>2010-03-02 14:07:10 +1100
commit7ad931dda929e230b90d6ce3f35db7480321d6b0 (patch)
tree9b8149f211a2f8af300817a9779b09aa0210b6e0 /source4/scripting/python
parentfc6d9e7b4f191ec7efea4c87fdeb461f8ed43bba (diff)
downloadsamba-7ad931dda929e230b90d6ce3f35db7480321d6b0.tar.gz
samba-7ad931dda929e230b90d6ce3f35db7480321d6b0.tar.bz2
samba-7ad931dda929e230b90d6ce3f35db7480321d6b0.zip
s4:provision - Moved setup_db_config() into OpenLDAPBackend class.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/provisionbackend.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py
index 9018f0f7cb..75e00979df 100644
--- a/source4/scripting/python/samba/provisionbackend.py
+++ b/source4/scripting/python/samba/provisionbackend.py
@@ -42,19 +42,6 @@ from samba.credentials import Credentials, DONT_USE_KERBEROS
from samba.schema import Schema
from samba.provisionexceptions import ProvisioningError
-def setup_db_config(setup_path, dbdir):
- """Setup a Berkeley database.
-
- :param setup_path: Setup path function.
- :param dbdir: Database directory."""
- if not os.path.isdir(os.path.join(dbdir, "bdb-logs")):
- os.makedirs(os.path.join(dbdir, "bdb-logs"), 0700)
- if not os.path.isdir(os.path.join(dbdir, "tmp")):
- os.makedirs(os.path.join(dbdir, "tmp"), 0700)
-
- setup_file(setup_path("DB_CONFIG"), os.path.join(dbdir, "DB_CONFIG"),
- {"LDAPDBDIR": dbdir})
-
class ProvisionBackend(object):
def __init__(self, backend_type, paths=None, setup_path=None, lp=None, credentials=None,
names=None, message=None):
@@ -310,6 +297,19 @@ class OpenLDAPBackend(LDAPBackend):
serverdn=self.names.serverdn,
files=[setup_path("schema_samba4.ldif")])
+ def setup_db_config(self, dbdir):
+ """Setup a Berkeley database.
+
+ :param setup_path: Setup path function.
+ :param dbdir: Database directory."""
+ if not os.path.isdir(os.path.join(dbdir, "bdb-logs")):
+ os.makedirs(os.path.join(dbdir, "bdb-logs"), 0700)
+ if not os.path.isdir(os.path.join(dbdir, "tmp")):
+ os.makedirs(os.path.join(dbdir, "tmp"), 0700)
+
+ setup_file(self.setup_path("DB_CONFIG"), os.path.join(dbdir, "DB_CONFIG"),
+ {"LDAPDBDIR": dbdir})
+
def provision(self):
# Wipe the directories so we can start
shutil.rmtree(os.path.join(self.ldapdir, "db"), True)
@@ -442,9 +442,9 @@ class OpenLDAPBackend(LDAPBackend):
"INDEX_CONFIG": index_config,
"NOSYNC": nosync_config})
- setup_db_config(self.setup_path, os.path.join(self.ldapdir, "db", "user"))
- setup_db_config(self.setup_path, os.path.join(self.ldapdir, "db", "config"))
- setup_db_config(self.setup_path, os.path.join(self.ldapdir, "db", "schema"))
+ self.setup_db_config(os.path.join(self.ldapdir, "db", "user"))
+ self.setup_db_config(os.path.join(self.ldapdir, "db", "config"))
+ self.setup_db_config(os.path.join(self.ldapdir, "db", "schema"))
if not os.path.exists(os.path.join(self.ldapdir, "db", "samba", "cn=samba")):
os.makedirs(os.path.join(self.ldapdir, "db", "samba", "cn=samba"), 0700)