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