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