c14a06
From e713c227bb420a841ce3ae146bca55a84a1b0dbf Mon Sep 17 00:00:00 2001
c14a06
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
c14a06
Date: Tue, 22 Jun 2021 14:36:51 +0200
c14a06
Subject: [PATCH] paths: add IPA_SERVER_CONF
c14a06
MIME-Version: 1.0
c14a06
Content-Type: text/plain; charset=UTF-8
c14a06
Content-Transfer-Encoding: 8bit
c14a06
c14a06
Related: https://pagure.io/freeipa/issue/8891
c14a06
Signed-off-by: François Cami <fcami@redhat.com>
c14a06
Reviewed-By: Stanislav Levin <slev@altlinux.org>
c14a06
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
c14a06
---
c14a06
 ipaplatform/base/paths.py | 1 +
c14a06
 1 file changed, 1 insertion(+)
c14a06
c14a06
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
c14a06
index 91423b332..de217d9ef 100644
c14a06
--- a/ipaplatform/base/paths.py
c14a06
+++ b/ipaplatform/base/paths.py
c14a06
@@ -71,6 +71,7 @@ class BasePathNamespace:
c14a06
     IPA_DEFAULT_CONF = "/etc/ipa/default.conf"
c14a06
     IPA_DNSKEYSYNCD_KEYTAB = "/etc/ipa/dnssec/ipa-dnskeysyncd.keytab"
c14a06
     IPA_ODS_EXPORTER_KEYTAB = "/etc/ipa/dnssec/ipa-ods-exporter.keytab"
c14a06
+    IPA_SERVER_CONF = "/etc/ipa/server.conf"
c14a06
     DNSSEC_OPENSSL_CONF = "/etc/ipa/dnssec/openssl.cnf"
c14a06
     DNSSEC_SOFTHSM2_CONF = "/etc/ipa/dnssec/softhsm2.conf"
c14a06
     DNSSEC_SOFTHSM_PIN_SO = "/etc/ipa/dnssec/softhsm_pin_so"
c14a06
-- 
c14a06
2.31.1
c14a06
c14a06
From ee4be290e1583834a573c3896ee1d97b3fbb6c24 Mon Sep 17 00:00:00 2001
c14a06
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
c14a06
Date: Tue, 22 Jun 2021 14:45:49 +0200
c14a06
Subject: [PATCH] ipatests: smoke test for server debug mode.
c14a06
MIME-Version: 1.0
c14a06
Content-Type: text/plain; charset=UTF-8
c14a06
Content-Transfer-Encoding: 8bit
c14a06
c14a06
Add a smoke test to make sure the server can be set in debug mode
c14a06
without issue.
c14a06
c14a06
Related: https://pagure.io/freeipa/issue/8891
c14a06
Signed-off-by: François Cami <fcami@redhat.com>
c14a06
Reviewed-By: Stanislav Levin <slev@altlinux.org>
c14a06
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
c14a06
---
c14a06
 .../test_integration/test_installation.py     | 27 +++++++++++++++++++
c14a06
 1 file changed, 27 insertions(+)
c14a06
c14a06
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
c14a06
index 301767b8d..0c96536f0 100644
c14a06
--- a/ipatests/test_integration/test_installation.py
c14a06
+++ b/ipatests/test_integration/test_installation.py
c14a06
@@ -703,6 +703,33 @@ class TestInstallMaster(IntegrationTest):
c14a06
     def test_install_master(self):
c14a06
         tasks.install_master(self.master, setup_dns=False)
c14a06
 
c14a06
+    @pytest.mark.skip_if_platform(
c14a06
+        "debian", reason="This test hardcodes the httpd service name"
c14a06
+    )
c14a06
+    def test_smoke_test_for_debug_mode(self):
c14a06
+        """Test if an IPA server works in debug mode.
c14a06
+        Related: https://pagure.io/freeipa/issue/8891
c14a06
+
c14a06
+        Note: this test hardcodes the "httpd" service name.
c14a06
+        """
c14a06
+
c14a06
+        target_fname = paths.IPA_SERVER_CONF
c14a06
+        assert not self.master.transport.file_exists(target_fname)
c14a06
+
c14a06
+        # set the IPA server in debug mode
c14a06
+        server_conf = "[global]\ndebug=True"
c14a06
+        self.master.put_file_contents(target_fname, server_conf)
c14a06
+        self.master.run_command(["systemctl", "restart", "httpd"])
c14a06
+
c14a06
+        # smoke test in debug mode
c14a06
+        tasks.kdestroy_all(self.master)
c14a06
+        tasks.kinit_admin(self.master)
c14a06
+        self.master.run_command(["ipa", "user-show", "admin"])
c14a06
+
c14a06
+        # rollback
c14a06
+        self.master.run_command(["rm", target_fname])
c14a06
+        self.master.run_command(["systemctl", "restart", "httpd"])
c14a06
+
c14a06
     def test_schema_compat_attribute_and_tree_disable(self):
c14a06
         """Test if schema-compat-entry-attribute is set
c14a06
 
c14a06
-- 
c14a06
2.31.1
c14a06
c14a06
From 1539c7383116647ad9c5b125b343f972e9c9653b Mon Sep 17 00:00:00 2001
c14a06
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
c14a06
Date: Wed, 23 Jun 2021 06:35:19 +0200
c14a06
Subject: [PATCH] rpcserver.py: perf_counter_ns is Python 3.7+
c14a06
MIME-Version: 1.0
c14a06
Content-Type: text/plain; charset=UTF-8
c14a06
Content-Transfer-Encoding: 8bit
c14a06
c14a06
perf_counter_ns is only available in Python 3.7 and later.
c14a06
Define a lambda for 3.6 and lower.
c14a06
c14a06
Fixes: https://pagure.io/freeipa/issue/8891
c14a06
Signed-off-by: François Cami <fcami@redhat.com>
c14a06
Reviewed-By: Stanislav Levin <slev@altlinux.org>
c14a06
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
c14a06
---
c14a06
 ipaserver/rpcserver.py | 5 +++++
c14a06
 1 file changed, 5 insertions(+)
c14a06
c14a06
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
c14a06
index b121316bf..e612528e0 100644
c14a06
--- a/ipaserver/rpcserver.py
c14a06
+++ b/ipaserver/rpcserver.py
c14a06
@@ -31,6 +31,7 @@ import os
c14a06
 import time
c14a06
 import traceback
c14a06
 from io import BytesIO
c14a06
+from sys import version_info
c14a06
 from urllib.parse import parse_qs
c14a06
 from xmlrpc.client import Fault
c14a06
 
c14a06
@@ -72,6 +73,10 @@ from requests.auth import AuthBase
c14a06
 if six.PY3:
c14a06
     unicode = str
c14a06
 
c14a06
+# time.perf_counter_ns appeared in Python 3.7.
c14a06
+if version_info < (3, 7):
c14a06
+    time.perf_counter_ns = lambda: int(time.perf_counter() * 10**9)
c14a06
+
c14a06
 logger = logging.getLogger(__name__)
c14a06
 
c14a06
 HTTP_STATUS_SUCCESS = '200 Success'
c14a06
-- 
c14a06
2.31.1
c14a06