From d1e5a7380619043a351ba8a25ebb8031163e70b7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 5 Feb 2011 10:34:51 +1100 Subject: s4-provision Remove setup_path, setup_dir and find_setup_dir We now have a reliable way to know the current location of the templates: dyn_SETUPDIR, which is updated for both the in-build and installed binaries. This replaces the function arguments and the distributed resolution of the setup directory with one 'global' function (imported as required). This also removes the ability to specify an alternate setup directory on the command line, as this was rarely if ever used and never tested. Andrew Bartlett --- source4/scripting/python/samba/tests/provision.py | 11 +++-------- source4/scripting/python/samba/tests/samdb.py | 13 +++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'source4/scripting/python/samba/tests') diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index f6a5571840..39a01606bb 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -20,15 +20,10 @@ """Tests for samba.provision.""" import os -from samba.provision import setup_secretsdb, findnss, ProvisionPaths, find_setup_dir +from samba.provision import setup_secretsdb, findnss, ProvisionPaths import samba.tests from samba.tests import env_loadparm, TestCase -setup_dir = find_setup_dir() -def setup_path(file): - return os.path.join(setup_dir, file) - - def create_dummy_secretsdb(path, lp=None): """Create a dummy secrets database for use in tests. @@ -43,7 +38,7 @@ def create_dummy_secretsdb(path, lp=None): paths.private_dir = os.path.dirname(path) paths.keytab = "no.keytab" paths.dns_keytab = "no.dns.keytab" - secrets_ldb = setup_secretsdb(paths, setup_path, None, None, lp=lp) + secrets_ldb = setup_secretsdb(paths, None, None, lp=lp) secrets_ldb.transaction_commit() return secrets_ldb @@ -59,7 +54,7 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir): paths.private_dir = os.path.dirname(path) paths.keytab = "no.keytab" paths.dns_keytab = "no.dns.keytab" - ldb = setup_secretsdb(paths, setup_path, None, None, lp=env_loadparm()) + ldb = setup_secretsdb(paths, None, None, lp=env_loadparm()) try: self.assertEquals("LSA Secrets", ldb.searchone(basedn="CN=LSA Secrets", attribute="CN")) diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py index cedb0d0baf..3df72b0840 100644 --- a/source4/scripting/python/samba/tests/samdb.py +++ b/source4/scripting/python/samba/tests/samdb.py @@ -25,7 +25,7 @@ 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) + provision_paths_from_lp) from samba.provision import DEFAULT_POLICY_GUID, DEFAULT_DC_POLICY_GUID from samba.provision.backend import ProvisionBackend from samba.tests import TestCaseInTempDir @@ -41,9 +41,6 @@ class SamDBTestCase(TestCaseInTempDir): provisioning tests (which need a Sam). """ - def setup_path(self, relpath): - return os.path.join(find_setup_dir(), relpath) - def setUp(self): super(SamDBTestCase, self).setUp() invocationid = str(uuid.uuid4()) @@ -64,7 +61,7 @@ class SamDBTestCase(TestCaseInTempDir): policyguid_dc = DEFAULT_DC_POLICY_GUID smbconf = os.path.join(self.tempdir, "smb.conf") - make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain, + make_smbconf(smbconf, hostname, domain, dnsdomain, serverrole, self.tempdir) self.lp = param.LoadParm() @@ -81,14 +78,14 @@ class SamDBTestCase(TestCaseInTempDir): logger = logging.getLogger("provision") provision_backend = ProvisionBackend("ldb", paths=paths, - setup_path=self.setup_path, lp=self.lp, credentials=None, + lp=self.lp, credentials=None, names=names, logger=logger) - schema = Schema(self.setup_path, domainsid, invocationid=invocationid, + schema = Schema(domainsid, invocationid=invocationid, schemadn=names.schemadn, serverdn=names.serverdn, am_rodc=False) - self.samdb = setup_samdb(path, self.setup_path, session_info, + self.samdb = setup_samdb(path, session_info, provision_backend, self.lp, names, logger, domainsid, domainguid, policyguid, policyguid_dc, False, "secret", "secret", "secret", invocationid, "secret", -- cgit