mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
Fixes CA always being presented as running
Even after manually stopping the pki-tomcatd service instance the service's is_running() method would still return True. https://fedorahosted.org/freeipa/ticket/5898 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
parent
01795fca83
commit
fb4e19713d
@ -148,7 +148,7 @@ class PlatformService(object):
|
||||
def restart(self, instance_name="", capture_output=True, wait=True):
|
||||
return
|
||||
|
||||
def is_running(self, instance_name=""):
|
||||
def is_running(self, instance_name="", wait=True):
|
||||
return False
|
||||
|
||||
def is_installed(self):
|
||||
@ -303,7 +303,7 @@ class SystemdService(PlatformService):
|
||||
if wait and self.is_running(instance_name):
|
||||
self.wait_for_open_ports(self.service_instance(instance_name))
|
||||
|
||||
def is_running(self, instance_name=""):
|
||||
def is_running(self, instance_name="", wait=True):
|
||||
instance = self.service_instance(instance_name, 'is-active')
|
||||
|
||||
while True:
|
||||
|
@ -222,6 +222,23 @@ class RedHatCAService(RedHatService):
|
||||
if wait:
|
||||
self.wait_until_running()
|
||||
|
||||
def is_running(self, instance_name="", wait=True):
|
||||
if instance_name:
|
||||
return super(RedHatCAService, self).is_running(instance_name)
|
||||
try:
|
||||
status = dogtag.ca_status()
|
||||
if status == 'running':
|
||||
return True
|
||||
elif status == 'starting' and wait:
|
||||
# Exception is raised if status is 'starting' even after wait
|
||||
self.wait_until_running()
|
||||
return True
|
||||
except Exception as e:
|
||||
root_logger.debug(
|
||||
'Failed to check CA status: {err}'.format(err=e)
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
# Function that constructs proper Red Hat OS family-specific server classes for
|
||||
# services of specified name
|
||||
|
@ -347,8 +347,8 @@ class Service(object):
|
||||
def restart(self, instance_name="", capture_output=True, wait=True):
|
||||
self.service.restart(instance_name, capture_output=capture_output, wait=wait)
|
||||
|
||||
def is_running(self):
|
||||
return self.service.is_running()
|
||||
def is_running(self, instance_name="", wait=True):
|
||||
return self.service.is_running(instance_name, wait)
|
||||
|
||||
def install(self):
|
||||
self.service.install()
|
||||
|
Loading…
Reference in New Issue
Block a user