pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0110-restore-restart-reload-gssproxy-after-restore.patch

483b06
From 5a2424fc07c931be1788bca19726df41f02479e7 Mon Sep 17 00:00:00 2001
483b06
From: Petr Vobornik <pvoborni@redhat.com>
483b06
Date: Wed, 26 Apr 2017 18:47:53 +0200
483b06
Subject: [PATCH] restore: restart/reload gssproxy after restore
483b06
483b06
So that gssproxy picks up new configuration and therefore related
483b06
usages like authentication of CLI against server works
483b06
483b06
https://pagure.io/freeipa/issue/6902
483b06
483b06
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
483b06
---
483b06
 ipaplatform/base/services.py     | 21 ++++++++++++++++++---
483b06
 ipaserver/install/ipa_restore.py |  3 +++
483b06
 2 files changed, 21 insertions(+), 3 deletions(-)
483b06
483b06
diff --git a/ipaplatform/base/services.py b/ipaplatform/base/services.py
483b06
index 068b9723cab2773ca2e274e1734723371410675a..fca6298fc07e03ab4ceeba0b51286e33ae168fcc 100644
483b06
--- a/ipaplatform/base/services.py
483b06
+++ b/ipaplatform/base/services.py
483b06
@@ -154,6 +154,10 @@ class PlatformService(object):
483b06
 
483b06
         return
483b06
 
483b06
+    def reload_or_restart(self, instance_name="", capture_output=True,
483b06
+                          wait=True):
483b06
+        return
483b06
+
483b06
     def restart(self, instance_name="", capture_output=True, wait=True):
483b06
         return
483b06
 
483b06
@@ -298,14 +302,25 @@ class SystemdService(PlatformService):
483b06
             instance_name,
483b06
             update_service_list=update_service_list)
483b06
 
483b06
-    def restart(self, instance_name="", capture_output=True, wait=True):
483b06
-        ipautil.run([paths.SYSTEMCTL, "restart",
483b06
-                     self.service_instance(instance_name)],
483b06
+    def _restart_base(self, instance_name, operation, capture_output=True,
483b06
+                      wait=False):
483b06
+
483b06
+        ipautil.run([paths.SYSTEMCTL, operation,
483b06
+                    self.service_instance(instance_name)],
483b06
                     skip_output=not capture_output)
483b06
 
483b06
         if wait and self.is_running(instance_name):
483b06
             self.wait_for_open_ports(self.service_instance(instance_name))
483b06
 
483b06
+    def reload_or_restart(self, instance_name="", capture_output=True,
483b06
+                          wait=True):
483b06
+        self._restart_base(instance_name, "reload-or-restart",
483b06
+                           capture_output, wait)
483b06
+
483b06
+    def restart(self, instance_name="", capture_output=True, wait=True):
483b06
+        self._restart_base(instance_name, "restart",
483b06
+                           capture_output, wait)
483b06
+
483b06
     def is_running(self, instance_name="", wait=True):
483b06
         instance = self.service_instance(instance_name, 'is-active')
483b06
 
483b06
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
483b06
index 378c013b6f4a4656768d7a484d2014a0f9eef3c0..96fc493c774f5de4c8149bf477cb66ec4960de4f 100644
483b06
--- a/ipaserver/install/ipa_restore.py
483b06
+++ b/ipaserver/install/ipa_restore.py
483b06
@@ -401,6 +401,9 @@ class Restore(admintool.AdminTool):
483b06
                 services.knownservices.pki_tomcatd.enable()
483b06
                 services.knownservices.pki_tomcatd.disable()
483b06
 
483b06
+                self.log.info('Restarting GSS-proxy')
483b06
+                gssproxy = services.service('gssproxy', api)
483b06
+                gssproxy.reload_or_restart()
483b06
                 self.log.info('Starting IPA services')
483b06
                 run(['ipactl', 'start'])
483b06
                 self.log.info('Restarting SSSD')
483b06
-- 
483b06
2.12.2
483b06