From f0829efe1f93bc80695b1e26d0edf792b31afd89 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Sep 17 2012 22:43:59 +0000 Subject: Only stop the main DS instance when upgrading it We've been stopping both DS instances (main and PKI) when upgrading. This can happen while the CA is running. In some cases stopping the PKI DS also killed the CA. Only stop the specific instance for upgrades. Also, wait for open ports after the upgrade is complete. The wait was skipped previously. This can prevent bugs if scripts that need a DS are run after the upgrade. https://fedorahosted.org/freeipa/ticket/3083 --- diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py index f1f702b..3c6bbec 100644 --- a/ipaserver/install/upgradeinstance.py +++ b/ipaserver/install/upgradeinstance.py @@ -59,19 +59,24 @@ class IPAUpgrade(service.Service): self.modified = False self.badsyntax = False self.upgradefailed = False + self.serverid = serverid - def start(self, instance_name="", capture_output=True, wait=True): + def __start_nowait(self): # Don't wait here because we've turned off port 389. The connection # we make will wait for the socket. - super(IPAUpgrade, self).start(instance_name, capture_output, wait=False) + super(IPAUpgrade, self).start(wait=False) + + def __stop_instance(self): + """Stop only the main DS instance""" + super(IPAUpgrade, self).stop(self.serverid) def create_instance(self): - self.step("stopping directory server", self.stop) + self.step("stopping directory server", self.__stop_instance) self.step("saving configuration", self.__save_config) self.step("disabling listeners", self.__disable_listeners) - self.step("starting directory server", self.start) + self.step("starting directory server", self.__start_nowait) self.step("upgrading server", self.__upgrade) - self.step("stopping directory server", self.stop) + self.step("stopping directory server", self.__stop_instance) self.step("restoring configuration", self.__restore_config) self.step("starting directory server", self.start)