mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add conditional restart (try-restart) capability to services
This will conditionally restart a service if it is active. https://pagure.io/freeipa/issue/8105 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Ade Lee <alee@redhat.com>
This commit is contained in:
@@ -173,6 +173,9 @@ class PlatformService:
|
|||||||
def restart(self, instance_name="", capture_output=True, wait=True):
|
def restart(self, instance_name="", capture_output=True, wait=True):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def try_restart(self, instance_name="", capture_output=True, wait=True):
|
||||||
|
pass
|
||||||
|
|
||||||
def is_running(self, instance_name="", wait=True):
|
def is_running(self, instance_name="", wait=True):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -338,6 +341,10 @@ class SystemdService(PlatformService):
|
|||||||
self._restart_base(instance_name, "restart",
|
self._restart_base(instance_name, "restart",
|
||||||
capture_output, wait)
|
capture_output, wait)
|
||||||
|
|
||||||
|
def try_restart(self, instance_name="", capture_output=True, wait=True):
|
||||||
|
self._restart_base(instance_name, "try-restart",
|
||||||
|
capture_output, wait)
|
||||||
|
|
||||||
def is_running(self, instance_name="", wait=True):
|
def is_running(self, instance_name="", wait=True):
|
||||||
instance = self.service_instance(instance_name, 'is-active')
|
instance = self.service_instance(instance_name, 'is-active')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user