ipa/SOURCES/0018-dogtaginstance.py-add-...

118 lines
4.6 KiB
Diff

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