summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-14 02:15:32 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-15 17:21:39 +0200
commit8c88c9c5006bd4e23105740defa7db0949a21e74 (patch)
tree3f2675a0c2d81e609917521280c84551e1b9b747 /source4/scripting
parent026fcc6a4f1b50518f2b1d33b278f5b671fb18a1 (diff)
downloadsamba-8c88c9c5006bd4e23105740defa7db0949a21e74.tar.gz
samba-8c88c9c5006bd4e23105740defa7db0949a21e74.tar.bz2
samba-8c88c9c5006bd4e23105740defa7db0949a21e74.zip
Attempt to fix SamDB test infrastructure (not used in Samba anywhere, only in OpenChange).
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/provision.py6
-rw-r--r--source4/scripting/python/samba/tests/samdb.py40
2 files changed, 25 insertions, 21 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 60d7fc9271..8b07f892e9 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -416,7 +416,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,eadb):
+ targetdir, sid_generator="internal", eadb=False):
"""Create a new smb.conf file based on a couple of basic settings.
"""
assert smbconf is not None
@@ -844,7 +844,7 @@ def setup_gpo(sysvolpath, dnsdomain, policyguid, policyguid_dc):
def setup_samdb(path, setup_path, session_info, provision_backend, lp, names,
logger, domainsid, domainguid, policyguid, policyguid_dc, fill,
adminpass, krbtgtpass, machinepass, invocationid, dnspass, ntdsguid,
- serverrole, am_rodc, dom_for_fun_level=None, schema=None):
+ serverrole, am_rodc=False, dom_for_fun_level=None, schema=None):
"""Setup a complete SAM Database.
:note: This will wipe the main SAM database file!
@@ -1120,7 +1120,7 @@ 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):
"""Provision samba4
:note: caution, this wipes all existing data!
diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py
index 9645c0464b..0ad53cc779 100644
--- a/source4/scripting/python/samba/tests/samdb.py
+++ b/source4/scripting/python/samba/tests/samdb.py
@@ -16,13 +16,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from samba.auth import system_session
import logging
import os
-from samba.provision import setup_samdb, guess_names, make_smbconf, find_setup_dir
+import uuid
+
+from samba.auth import system_session
+from samba.provision import setup_samdb, guess_names, make_smbconf, find_setup_dir, provision_paths_from_lp
+from samba.provisionbackend import ProvisionBackend
from samba.tests import TestCaseInTempDir
from samba.dcerpc import security
-import uuid
+from samba.schema import Schema
from samba import param
@@ -53,6 +56,7 @@ class SamDBTestCase(TestCaseInTempDir):
domain="EXAMPLE"
dnsdomain="example.com"
serverrole="domain controller"
+ policyguid_dc = str(uuid.uuid4()).upper()
smbconf = os.path.join(self.tempdir, "smb.conf")
make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain,
@@ -69,21 +73,21 @@ class SamDBTestCase(TestCaseInTempDir):
paths = provision_paths_from_lp(self.lp, names.dnsdomain)
- provision_backend = ProvisionBackend("ldb", backend_type,
- paths=paths, setup_path=self.setup_path,
- lp=self.lp, credentials=None,
- names=names,
- message=message, hostname=hostname,
- root=root, schema=schema,
- domainsid=domainsid)
-
- self.samdb = setup_samdb(path, self.setup_path, session_info, provision_backend,
- self.lp, names,
- logging.getLogger("samdb"), domainsid,
- domainguid,
- policyguid, False, "secret",
- "secret", "secret", invocationid,
- "secret", "domain controller")
+ logger = logging.getLogger("provision")
+
+ provision_backend = ProvisionBackend("ldb", paths=paths,
+ setup_path=self.setup_path, lp=self.lp, credentials=None,
+ names=names, logger=logger)
+
+ schema = Schema(self.setup_path, domainsid, invocationid=invocationid,
+ schemadn=names.schemadn, serverdn=names.serverdn,
+ am_rodc=False)
+
+ self.samdb = setup_samdb(path, self.setup_path, session_info,
+ provision_backend, self.lp, names, logger,
+ domainsid, domainguid, policyguid, policyguid_dc, False,
+ "secret", "secret", "secret", invocationid, "secret",
+ None, "domain controller", schema=schema)
def tearDown(self):
for f in ['schema.ldb', 'configuration.ldb',