From 373455026e37d93c699e4ced579c75e2af8042aa Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Jan 2011 09:17:08 -0500 Subject: Add a way to print output from commands Instead pof always capturing the output, make it possible to let it go to the standard output pipes. Use this in ipactl to let init scripts show their output. Fixes: https://fedorahosted.org/freeipa/ticket/765 --- ipaserver/install/service.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'ipaserver/install') diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index ef3becdf..1235eaff 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -41,14 +41,17 @@ SERVICE_LIST = { 'CA':('pki-cad', 50) } -def stop(service_name, instance_name=""): - ipautil.run(["/sbin/service", service_name, "stop", instance_name]) +def stop(service_name, instance_name="", capture_output=True): + ipautil.run(["/sbin/service", service_name, "stop", instance_name], + capture_output=capture_output) -def start(service_name, instance_name=""): - ipautil.run(["/sbin/service", service_name, "start", instance_name]) +def start(service_name, instance_name="", capture_output=True): + ipautil.run(["/sbin/service", service_name, "start", instance_name], + capture_output=capture_output) -def restart(service_name, instance_name=""): - ipautil.run(["/sbin/service", service_name, "restart", instance_name]) +def restart(service_name, instance_name="", capture_output=True): + ipautil.run(["/sbin/service", service_name, "restart", instance_name], + capture_output=capture_output) def is_running(service_name, instance_name=""): ret = True @@ -217,14 +220,14 @@ class Service: def set_output(self, fd): self.output_fd = fd - def stop(self, instance_name=""): - stop(self.service_name, instance_name) + def stop(self, instance_name="", capture_output=True): + stop(self.service_name, instance_name, capture_output=capture_output) - def start(self, instance_name=""): - start(self.service_name, instance_name) + def start(self, instance_name="", capture_output=True): + start(self.service_name, instance_name, capture_output=capture_output) - def restart(self, instance_name=""): - restart(self.service_name, instance_name) + def restart(self, instance_name="", capture_output=True): + restart(self.service_name, instance_name, capture_output=capture_output) def is_running(self): return is_running(self.service_name) -- cgit