5144c6
Adapted version of d1c860e59b52. to make it apply without commits
5144c6
5144c6
34b4d9bce5 - ipatests: Test ipa user login with wrong password
5144c6
ab36d79adc - ipatests: Test for ipa-nis-manage CLI tool.
5144c6
5144c6
From d1c860e59b5237178066ed963cc2fa50d99cd690 Mon Sep 17 00:00:00 2001
5144c6
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
5144c6
Date: Wed, 16 Sep 2020 17:07:21 +0200
5144c6
Subject: [PATCH] ipatests: check that pkispawn log is not empty
5144c6
MIME-Version: 1.0
5144c6
Content-Type: text/plain; charset=UTF-8
5144c6
Content-Transfer-Encoding: 8bit
5144c6
5144c6
Since commits:
5144c6
https://github.com/dogtagpki/pki/commit/0102d836f4eac0fcea0adddb4c98d5ea05e4e8f6
5144c6
https://github.com/dogtagpki/pki/commit/de217557a642d799b1c4c390efa55493707c738e
5144c6
pkispawn will not honor the pki_log_level configuration item.
5144c6
All 10.9 Dogtag versions have these commits.
5144c6
This affects FreeIPA in that it makes debugging Dogtag installation issues next
5144c6
to impossible.
5144c6
Adding --debug to the pkispawn CLI is required to revert to the previous
5144c6
behavior.
5144c6
Therefore check that the log is not empty and contains DEBUG+INFO lines.
5144c6
5144c6
Fixes: https://pagure.io/freeipa/issue/8503
5144c6
Signed-off-by: François Cami <fcami@redhat.com>
5144c6
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
5144c6
Reviewed-By: Christian Heimes <cheimes@redhat.com>
5144c6
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
5144c6
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
5144c6
Reviewed-By: Christian Heimes <cheimes@redhat.com>
5144c6
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
5144c6
---
5144c6
 ipatests/test_integration/test_commands.py | 23 ++++++++++++++++++++++
5144c6
 1 file changed, 23 insertions(+)
5144c6
5144c6
diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
5144c6
index fa6abd81e..3a12bcde2 100644
5144c6
--- a/ipatests/test_integration/test_commands.py
5144c6
+++ b/ipatests/test_integration/test_commands.py
5144c6
@@ -1295,3 +1295,26 @@ class TestIPACommand(IntegrationTest):
5144c6
             assert msg2 not in result.stderr_text
5144c6
         finally:
5144c6
             bashrc_backup.restore()
5144c6
+
5144c6
+    def test_pkispawn_log_is_present(self):
5144c6
+        """
5144c6
+        This testcase checks if pkispawn logged properly.
5144c6
+        It is a candidate from being moved out of test_commands.
5144c6
+        """
5144c6
+        result = self.master.run_command(
5144c6
+            ["ls", "/var/log/pki/"]
5144c6
+        )
5144c6
+        pkispawnlogfile = None
5144c6
+        for file in result.stdout_text.splitlines():
5144c6
+            if file.startswith("pki-ca-spawn"):
5144c6
+                pkispawnlogfile = file
5144c6
+                break
5144c6
+        assert pkispawnlogfile is not None
5144c6
+        pkispawnlogfile = os.path.sep.join(("/var/log/pki", pkispawnlogfile))
5144c6
+        pkispawnlog = self.master.get_file_contents(
5144c6
+            pkispawnlogfile, encoding='utf-8'
5144c6
+        )
5144c6
+        # Totally arbitrary. pkispawn debug logs tend to be > 10KiB.
5144c6
+        assert len(pkispawnlog) > 1024
5144c6
+        assert "DEBUG" in pkispawnlog
5144c6
+        assert "INFO" in pkispawnlog
5144c6
-- 
5144c6
2.26.2
5144c6
5144c6
From 97c6d2d2c2359b8ff5585afa0d2e5f5599cd5048 Mon Sep 17 00:00:00 2001
5144c6
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
5144c6
Date: Thu, 17 Sep 2020 07:31:59 +0200
5144c6
Subject: [PATCH] dogtaginstance.py: add --debug to pkispawn
5144c6
MIME-Version: 1.0
5144c6
Content-Type: text/plain; charset=UTF-8
5144c6
Content-Transfer-Encoding: 8bit
5144c6
5144c6
Since commits:
5144c6
https://github.com/dogtagpki/pki/commit/0102d836f4eac0fcea0adddb4c98d5ea05e4e8f6
5144c6
https://github.com/dogtagpki/pki/commit/de217557a642d799b1c4c390efa55493707c738e
5144c6
pkispawn will not honor the pki_log_level configuration item.
5144c6
All 10.9 Dogtag versions have these commits.
5144c6
This affects FreeIPA in that it makes debugging Dogtag installation issues next
5144c6
to impossible.
5144c6
Adding --debug to the pkispawn CLI is required to revert to the previous
5144c6
behavior.
5144c6
5144c6
Fixes: https://pagure.io/freeipa/issue/8503
5144c6
Signed-off-by: François Cami <fcami@redhat.com>
5144c6
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
5144c6
Reviewed-By: Christian Heimes <cheimes@redhat.com>
5144c6
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
5144c6
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
5144c6
Reviewed-By: Christian Heimes <cheimes@redhat.com>
5144c6
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
5144c6
---
5144c6
 ipaserver/install/dogtaginstance.py | 3 ++-
5144c6
 1 file changed, 2 insertions(+), 1 deletion(-)
5144c6
5144c6
diff --git a/ipaserver/install/dogtaginstance.py b/ipaserver/install/dogtaginstance.py
5144c6
index 524262ad7..03fdd7c0b 100644
5144c6
--- a/ipaserver/install/dogtaginstance.py
5144c6
+++ b/ipaserver/install/dogtaginstance.py
5144c6
@@ -183,7 +183,8 @@ class DogtagInstance(service.Service):
5144c6
         subsystem = self.subsystem
5144c6
         args = [paths.PKISPAWN,
5144c6
                 "-s", subsystem,
5144c6
-                "-f", cfg_file]
5144c6
+                "-f", cfg_file,
5144c6
+                "--debug"]
5144c6
 
5144c6
         with open(cfg_file) as f:
5144c6
             logger.debug(
5144c6
-- 
5144c6
2.26.2
5144c6