URL: https://github.com/freeipa/freeipa/pull/1546
Author: tiran
 Title: #1546: [Backport][ipa-4-6] Fix detection of KRA installation so 
upgrades can succeed
Action: opened

PR body:
"""
This PR was opened automatically because PR #1517 was pushed to master and 
backport to ipa-4-6 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1546/head:pr1546
git checkout pr1546
From da59645ff63e6b2f971c0d38248fb1d4945fb526 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Sun, 4 Feb 2018 11:40:24 -0500
Subject: [PATCH] Fix detection of KRA installation so upgrades can succeed

Use is_installed() instead of is_configured() because
is_installed() does a config file check to see if the service
is in use.

https://pagure.io/freeipa/issue/7389

Signed-off-by: Rob Crittenden <rcrit...@redhat.com>
---
 ipaserver/install/server/upgrade.py       |  4 ++--
 ipatests/test_integration/test_upgrade.py | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 ipatests/test_integration/test_upgrade.py

diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index 07cc18a78c..23173c0cae 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1710,7 +1710,7 @@ def upgrade_configuration():
             )
         upgrade_pki(ca, fstore)
 
-        if kra.is_configured():
+        if kra.is_installed():
             logger.info('[Ensuring ephemeralRequest is enabled in KRA]')
             kra.backup_config()
             value = installutils.get_directive(
@@ -1728,7 +1728,7 @@ def upgrade_configuration():
     # by checking status using http
     if ca.is_configured():
         ca.start('pki-tomcat')
-    if kra.is_configured() and not kra.is_running():
+    if kra.is_installed() and not kra.is_running():
         # This is for future-proofing in case the KRA is ever standalone.
         kra.start('pki-tomcat')
 
diff --git a/ipatests/test_integration/test_upgrade.py b/ipatests/test_integration/test_upgrade.py
new file mode 100644
index 0000000000..951747b0b3
--- /dev/null
+++ b/ipatests/test_integration/test_upgrade.py
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2018  FreeIPA Contributors see COPYING for license
+#
+
+"""
+Module provides tests to verify that the upgrade script works.
+"""
+
+from ipatests.test_integration.base import IntegrationTest
+from ipatests.pytest_plugins.integration import tasks
+
+
+class TestUpgrade(IntegrationTest):
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False)
+
+    def test_invoke_upgrader(self):
+        cmd = self.master.run_command(['ipa-server-upgrade'],
+                                      raiseonerr=False)
+        assert cmd.returncode == 0
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to