summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource4/scripting/bin/upgradeprovision3
-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
-rwxr-xr-xsource4/setup/provision4
7 files changed, 22 insertions, 13 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index aec0774a9d..2adb9a5b1a 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -1782,8 +1782,9 @@ if __name__ == '__main__':
message(SIMPLE, "Creating a reference provision")
provisiondir = tempfile.mkdtemp(dir=paths.private_dir,
prefix="referenceprovision")
- newprovision(names, creds, session, smbconf, provisiondir,
+ result = newprovision(names, creds, session, smbconf, provisiondir,
provision_logger)
+ result.report_logger(provision_logger)
# TODO
# 6) and 7)
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,
diff --git a/source4/setup/provision b/source4/setup/provision
index a2327b339e..4316ad00c6 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -243,7 +243,7 @@ elif opts.use_xattrs == "auto" and not lp.get("posix:eadb"):
session = system_session()
try:
- provision(logger,
+ result = provision(logger,
session, creds, smbconf=smbconf, targetdir=opts.targetdir,
samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
domainguid=opts.domain_guid, domainsid=opts.domain_sid,
@@ -263,3 +263,5 @@ try:
except ProvisioningError, e:
print str(e)
sys.exit(1)
+
+result.report_logger(logger)