From 412671ee48804867fc6707fa12409ae9365f5ea3 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 24 Sep 2007 14:52:43 -0400 Subject: Package the subprocess module so that we can use it on EL4. --- modules/process.py | 8 ++++---- modules/reboot.py | 4 ++-- modules/service.py | 4 ++-- modules/smart.py | 4 ++-- modules/virt.py | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'modules') diff --git a/modules/process.py b/modules/process.py index aa5e315..3e40fe1 100755 --- a/modules/process.py +++ b/modules/process.py @@ -15,7 +15,7 @@ ## # other modules -import subprocess +import sub_process # our modules from codes import * @@ -41,7 +41,7 @@ class ProcessModule(func_module.FuncModule): flags.replace(";","") # prevent stupidity - cmd = subprocess.Popen("ps %s" % flags,stdout=subprocess.PIPE,shell=True) + cmd = sub_process.Popen("ps %s" % flags,stdout=sub_process.PIPE,shell=True) data = cmd.communicate()[0] results = [] @@ -53,12 +53,12 @@ class ProcessModule(func_module.FuncModule): return results def kill(self,pid,level=""): - rc = subprocess.call("/bin/kill %s %s" % (pid, level), shell=True) + rc = sub_process.call("/bin/kill %s %s" % (pid, level), shell=True) return rc def pkill(self,name,level=""): # example killall("thunderbird","-9") - rc = subprocess.call("/usr/bin/pkill %s %s" % (name, level), shell=True) + rc = sub_process.call("/usr/bin/pkill %s %s" % (name, level), shell=True) return rc methods = ProcessModule() diff --git a/modules/reboot.py b/modules/reboot.py index ddc7651..8772b8f 100755 --- a/modules/reboot.py +++ b/modules/reboot.py @@ -11,7 +11,7 @@ from modules import func_module -import subprocess +import sub_process class Reboot(func_module.FuncModule): @@ -22,7 +22,7 @@ class Reboot(func_module.FuncModule): func_module.FuncModule.__init__(self) def reboot(self, when='now', message=''): - return subprocess.call(["/sbin/shutdown", '-r', when, message]) + return sub_process.call(["/sbin/shutdown", '-r', when, message]) methods = Reboot() diff --git a/modules/service.py b/modules/service.py index bbc51e1..524cd7b 100755 --- a/modules/service.py +++ b/modules/service.py @@ -18,7 +18,7 @@ from codes import * from modules import func_module -import subprocess +import sub_process import os class Service(func_module.FuncModule): @@ -37,7 +37,7 @@ class Service(func_module.FuncModule): filename = os.path.join("/etc/rc.d/init.d/",service_name) if os.path.exists(filename): - return subprocess.call(["/sbin/service", service_name, command]) + return sub_process.call(["/sbin/service", service_name, command]) else: raise FuncException("Service not installed: %s" % service_name) diff --git a/modules/smart.py b/modules/smart.py index 410e353..4ed8335 100755 --- a/modules/smart.py +++ b/modules/smart.py @@ -16,7 +16,7 @@ ## # other modules -import subprocess +import sub_process # our modules from codes import * @@ -40,7 +40,7 @@ class SmartModule(func_module.FuncModule): flags.replace(";","") # prevent stupidity - cmd = subprocess.Popen("/usr/sbin/smartd %s" % flags,stdout=subprocess.PIPE,shell=True) + cmd = sub_process.Popen("/usr/sbin/smartd %s" % flags,stdout=sub_process.PIPE,shell=True) data = cmd.communicate()[0] results = [] diff --git a/modules/virt.py b/modules/virt.py index d345d75..15be92c 100755 --- a/modules/virt.py +++ b/modules/virt.py @@ -22,7 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # other modules import sys import os -import subprocess +import sub_process import libvirt # our modules @@ -44,7 +44,7 @@ class FuncLibvirtConnection(): def __init__(self): - cmd = subprocess.Popen("uname -r", shell=True, stdout=subprocess.PIPE) + cmd = sub_process.Popen("uname -r", shell=True, stdout=sub_process.PIPE) output = cmd.communicate()[0] if output.find("xen") != -1: @@ -188,7 +188,7 @@ class Virt(func_module.FuncModule): "--server=%s" % server_name ] - rc = subprocess.call(koan_args,shell=False) + rc = sub_process.call(koan_args,shell=False) if rc == 0: return 0 else: -- cgit