summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-02-26 15:44:40 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-02-26 16:27:06 +0100
commit21f443eb8286805dde6bbb1b8f37379f6e0aa203 (patch)
tree512d27d2b9f67030b0bdecd7ebf574bfb34fc8cb /source4/scripting/python
parent02ba9095e234b391690f0756128203dd86b7b40d (diff)
downloadsamba-21f443eb8286805dde6bbb1b8f37379f6e0aa203.tar.gz
samba-21f443eb8286805dde6bbb1b8f37379f6e0aa203.tar.bz2
samba-21f443eb8286805dde6bbb1b8f37379f6e0aa203.zip
provision: Leave result reporting up to caller.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/join.py1
-rw-r--r--source4/scripting/python/samba/provision/__init__.py19
-rw-r--r--source4/scripting/python/samba/tests/provision.py5
-rw-r--r--source4/scripting/python/samba/upgrade.py1
-rwxr-xr-xsource4/scripting/python/samba/upgradehelpers.py2
5 files changed, 17 insertions, 11 deletions
diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py
index 10f8ad7e58..1e6e2c6898 100644
--- a/source4/scripting/python/samba/join.py
+++ b/source4/scripting/python/samba/join.py
@@ -599,6 +599,7 @@ class dc_join(object):
machinepass=ctx.acct_pass, serverrole="domain controller",
sitename=ctx.site, lp=ctx.lp, ntdsguid=ctx.ntds_guid,
dns_backend="NONE")
+ presult.report_logger(logger)
print "Provision OK for domain DN %s" % presult.domaindn
ctx.local_samdb = presult.samdb
ctx.lp = presult.lp
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index 6f7adc1a2f..526c07a37c 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -118,6 +118,7 @@ class ProvisionPaths(object):
self.dns = None
self.winsdb = None
self.private_dir = None
+ self.phpldapadminconfig = None
class ProvisionNames(object):
@@ -379,11 +380,16 @@ class ProvisionResult(object):
def report_logger(self, logger):
"""Report this provision result to a logger."""
- logger.info("Server Role: %s" % self.server_role)
- logger.info("Hostname: %s" % self.names.hostname)
- logger.info("NetBIOS Domain: %s" % self.names.domain)
- logger.info("DNS Domain: %s" % self.names.dnsdomain)
- logger.info("DOMAIN SID: %s" % self.domainsid)
+ logger.info("Server Role: %s", self.server_role)
+ logger.info("Hostname: %s", self.names.hostname)
+ logger.info("NetBIOS Domain: %s", self.names.domain)
+ logger.info("DNS Domain: %s", self.names.dnsdomain)
+ logger.info("DOMAIN SID: %s", self.domainsid)
+
+ if self.paths.phpldapadminconfig is not None:
+ logger.info(
+ "A phpLDAPadmin configuration file suitable for administering the Samba 4 LDAP server has been created in %s .",
+ self.paths.phpldapadminconfig)
def check_install(lp, session_info, credentials):
@@ -1837,9 +1843,6 @@ def provision(logger, session_info, credentials, smbconf=None,
result.samdb = samdb
result.idmap = idmap
result.domainsid = str(domainsid)
- result.report_logger(logger)
- logger.info("A phpLDAPadmin configuration file suitable for administering the Samba 4 LDAP server has been created in %s .",
- paths.phpldapadminconfig)
if samdb_fill == FILL_FULL:
if adminpass_generated:
diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index fc8451c8e5..937221407e 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -141,8 +141,8 @@ class DummyLogger(object):
def __init__(self):
self.entries = []
- def info(self, text):
- self.entries.append(("INFO", text))
+ def info(self, text, *args):
+ self.entries.append(("INFO", text % args))
class ProvisionResultTests(TestCase):
@@ -156,6 +156,7 @@ class ProvisionResultTests(TestCase):
result.names.domain = "DOMEIN"
result.names.dnsdomain = "dnsdomein"
result.domainsid = "S1-1-1"
+ result.paths = ProvisionPaths()
result.report_logger(logger)
self.assertEquals(logger.entries, [
('INFO', 'Server Role: domain controller'),
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 850035b9e9..b2fb51e3b7 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -643,6 +643,7 @@ Please fix this account before attempting to upgrade again
hostname=netbiosname.lower(), machinepass=machinepass,
serverrole=serverrole, samdb_fill=FILL_FULL,
useeadb=useeadb, dns_backend=dns_backend)
+ result.report_logger(logger)
# Import WINS database
logger.info("Importing WINS database")
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py
index a75ab75ada..c6c9527e36 100755
--- a/source4/scripting/python/samba/upgradehelpers.py
+++ b/source4/scripting/python/samba/upgradehelpers.py
@@ -259,7 +259,7 @@ def newprovision(names, creds, session, smbconf, provdir, logger):
os.mkdir(provdir)
logger.info("Provision stored in %s", provdir)
dns_backend="BIND9_DLZ"
- provision(logger, session, creds, smbconf=smbconf,
+ return provision(logger, session, creds, smbconf=smbconf,
targetdir=provdir, samdb_fill=FILL_FULL, realm=names.realm,
domain=names.domain, domainguid=names.domainguid,
domainsid=str(names.domainsid), ntdsguid=names.ntdsguid,