From 421ff0639e74b52ac723ed53c0368b2c980b838f Mon Sep 17 00:00:00 2001 From: Steve 'Ashcrow' Milner Date: Sun, 13 Jan 2008 12:44:03 -0500 Subject: Moved from sub_process to os.access for exists. --- func/minion/modules/command.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'func/minion/modules/command.py') diff --git a/func/minion/modules/command.py b/func/minion/modules/command.py index c849d42..3329927 100644 --- a/func/minion/modules/command.py +++ b/func/minion/modules/command.py @@ -22,7 +22,7 @@ class Command(func_module.FuncModule): def __init__(self): self.methods = { "run" : self.run, - "exists" : self.exists, + "exists" : self.exists, } func_module.FuncModule.__init__(self) @@ -32,7 +32,8 @@ class Command(func_module.FuncModule): NOT FOR USE WITH INTERACTIVE COMMANDS. """ - cmdref = sub_process.Popen(command.split(),stdout=sub_process.PIPE,stderr=sub_process.PIPE, shell=False) + cmdref = sub_process.Popen(command.split(), stdout=sub_process.PIPE, + stderr=sub_process.PIPE, shell=False) data = cmdref.communicate() return (cmdref.returncode, data[0], data[1]) @@ -40,12 +41,12 @@ class Command(func_module.FuncModule): """ Checks to see if a command exists on the target system(s). """ - cmdref = sub_process.Popen(['/usr/bin/which', command], stdout=sub_process.PIPE) - data = cmdref.communicate() - if cmdref.returncode == 0: + import os + + if os.access(command, os.X_OK): return True return False methods = Command() -register_rpc = methods.register_rpc +register_rpc = methods.register_rpc \ No newline at end of file -- cgit