From 62e7053a12fdfc38ac7ed212529c716428c7d92b Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 4 Dec 2012 13:55:30 -0500 Subject: Only update the list of running services in the installer or ipactl. The file is only present in the case of a server installation. It should only be touched by the server installer and ipactl. https://fedorahosted.org/freeipa/ticket/3277 --- ipapython/platform/base.py | 9 +++++++-- ipapython/platform/systemd.py | 12 ++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'ipapython/platform') diff --git a/ipapython/platform/base.py b/ipapython/platform/base.py index 8385e103..41a9c83e 100644 --- a/ipapython/platform/base.py +++ b/ipapython/platform/base.py @@ -136,12 +136,15 @@ class PlatformService(object): def __init__(self, service_name): self.service_name = service_name - def start(self, instance_name="", capture_output=True, wait=True): + def start(self, instance_name="", capture_output=True, wait=True, + update_service_list=True): """ When a service is started record the fact in a special file. This allows ipactl stop to always stop all services that have been started via ipa tools """ + if not update_service_list: + return svc_list = [] try: f = open(SVC_LIST_FILE, 'r') @@ -159,10 +162,12 @@ class PlatformService(object): f.close() return - def stop(self, instance_name="", capture_output=True): + def stop(self, instance_name="", capture_output=True, update_service_list=True): """ When a service is stopped remove it from the service list file. """ + if not update_service_list: + return svc_list = [] try: f = open(SVC_LIST_FILE, 'r') diff --git a/ipapython/platform/systemd.py b/ipapython/platform/systemd.py index bb6c0092..4e8a03f2 100644 --- a/ipapython/platform/systemd.py +++ b/ipapython/platform/systemd.py @@ -91,13 +91,21 @@ class SystemdService(base.PlatformService): def stop(self, instance_name="", capture_output=True): ipautil.run(["/bin/systemctl", "stop", self.service_instance(instance_name)], capture_output=capture_output) - super(SystemdService, self).stop(instance_name) + if 'context' in api.env and api.env.context in ['ipactl', 'installer']: + update_service_list = True + else: + update_service_list = False + super(SystemdService, self).stop(instance_name,update_service_list=update_service_list) def start(self, instance_name="", capture_output=True, wait=True): ipautil.run(["/bin/systemctl", "start", self.service_instance(instance_name)], capture_output=capture_output) + if 'context' in api.env and api.env.context in ['ipactl', 'installer']: + update_service_list = True + else: + update_service_list = False if wait and self.is_running(instance_name): self.__wait_for_open_ports(self.service_instance(instance_name)) - super(SystemdService, self).start(instance_name) + super(SystemdService, self).start(instance_name, update_service_list=update_service_list) def restart(self, instance_name="", capture_output=True, wait=True): # Restart command is broken before systemd-36-3.fc16 -- cgit