From cdc431ff9209c42a44fc487aa433570026851cd4 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Tue, 16 Apr 2019 14:50:55 +0200
Subject: [PATCH] ipa[client,replica,server]: Make sure that installer logs are
 created

The installer logs have not been created using the ansible ipaclient,
ipareplica and ipaserver roles. This has been fixed and the installer
logs are created now. This is a new and fixed version of 2113c79 where
verbose mode is turned off.
---
 roles/ipaclient/library/ipaclient_setup_nss.py       |  3 ---
 roles/ipaclient/module_utils/ansible_ipa_client.py   |  3 +++
 roles/ipareplica/module_utils/ansible_ipa_replica.py | 11 +++++++++--
 roles/ipaserver/module_utils/ansible_ipa_server.py   |  6 +++++-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/roles/ipaclient/library/ipaclient_setup_nss.py b/roles/ipaclient/library/ipaclient_setup_nss.py
index 4c12ae1f..2778ce9e 100644
--- a/roles/ipaclient/library/ipaclient_setup_nss.py
+++ b/roles/ipaclient/library/ipaclient_setup_nss.py
@@ -129,9 +129,6 @@ def main():
 
     fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
     statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
-    standard_logging_setup(
-        paths.IPACLIENT_INSTALL_LOG, verbose=True, debug=False,
-        filemode='a', console_format='%(message)s')
 
     os.environ['KRB5CCNAME'] = paths.IPA_DNS_CCACHE
     
diff --git a/roles/ipaclient/module_utils/ansible_ipa_client.py b/roles/ipaclient/module_utils/ansible_ipa_client.py
index c8870a35..345ad1d7 100644
--- a/roles/ipaclient/module_utils/ansible_ipa_client.py
+++ b/roles/ipaclient/module_utils/ansible_ipa_client.py
@@ -225,6 +225,9 @@ if NUM_VERSION >= 40400:
         sssd_enable_ifp = None
 
     logger = logging.getLogger("ipa-client-install")
+    standard_logging_setup(
+        paths.IPACLIENT_INSTALL_LOG, verbose=False, debug=False,
+        filemode='a', console_format='%(message)s')
     root_logger = logger
 
 else:
diff --git a/roles/ipareplica/module_utils/ansible_ipa_replica.py b/roles/ipareplica/module_utils/ansible_ipa_replica.py
index 3b06da68..76df774f 100644
--- a/roles/ipareplica/module_utils/ansible_ipa_replica.py
+++ b/roles/ipareplica/module_utils/ansible_ipa_replica.py
@@ -65,6 +65,7 @@ if NUM_VERSION >= 40600:
     from ipapython.certdb import IPA_CA_TRUST_FLAGS, EXTERNAL_CA_TRUST_FLAGS
     from ipapython.dn import DN
     from ipapython.admintool import ScriptError
+    from ipapython.ipa_log_manager import standard_logging_setup
     from ipaplatform import services
     from ipaplatform.tasks import tasks
     from ipaplatform.paths import paths
@@ -121,8 +122,10 @@ else:
 
 
 logger = logging.getLogger("ipa-server-install")
-logger.setLevel(logging.DEBUG)
-
+#logger.setLevel(logging.DEBUG)
+standard_logging_setup(
+    paths.IPAREPLICA_INSTALL_LOG, verbose=False, debug=False,
+    filemode='a', console_format='%(message)s')
 
 @contextlib_contextmanager
 def redirect_stdout(f):
@@ -227,6 +230,10 @@ options.disable_dnssec_master = False
 options.kasp_db_file = None
 options.force = False
 
+# ServerReplicaInstall
+options.subject_base = None
+options.ca_subject = None
+
 
 def api_Backend_ldap2(host_name, setup_ca, connect=False):
     # we are sure we have the configuration file ready.
diff --git a/roles/ipaserver/module_utils/ansible_ipa_server.py b/roles/ipaserver/module_utils/ansible_ipa_server.py
index 6713ae8c..ae5d16af 100644
--- a/roles/ipaserver/module_utils/ansible_ipa_server.py
+++ b/roles/ipaserver/module_utils/ansible_ipa_server.py
@@ -56,6 +56,7 @@ if NUM_VERSION >= 40500:
         from ipaclient.install.ipachangeconf import IPAChangeConf
     from ipalib.install import certmonger, sysrestore
     from ipapython import ipautil
+    from ipapython.ipa_log_manager import standard_logging_setup
     if NUM_VERSION < 40600:
         from ipapython.ipa_log_manager import root_logger
     from ipapython.ipautil import (
@@ -132,7 +133,10 @@ else:
 
 
 logger = logging.getLogger("ipa-server-install")
-logger.setLevel(logging.DEBUG)
+#logger.setLevel(logging.DEBUG)
+standard_logging_setup(
+    paths.IPASERVER_INSTALL_LOG, verbose=False, debug=False,
+    filemode='a', console_format='%(message)s')
 
 
 @contextlib_contextmanager
-- 
GitLab