summaryrefslogtreecommitdiffstats
path: root/func/minion/modules/command.py
diff options
context:
space:
mode:
authorSteve 'Ashcrow' Milner <stevem@gnulinux.net>2008-01-13 12:44:03 -0500
committerSteve 'Ashcrow' Milner <stevem@gnulinux.net>2008-01-13 12:44:03 -0500
commit421ff0639e74b52ac723ed53c0368b2c980b838f (patch)
treededa6e04d36675eb4025e77688e44bebfa215846 /func/minion/modules/command.py
parent8c4a154f196383f6d0969934e10641e83ac51af4 (diff)
downloadfunc-421ff0639e74b52ac723ed53c0368b2c980b838f.tar.gz
func-421ff0639e74b52ac723ed53c0368b2c980b838f.tar.xz
func-421ff0639e74b52ac723ed53c0368b2c980b838f.zip
Moved from sub_process to os.access for exists.
Diffstat (limited to 'func/minion/modules/command.py')
-rw-r--r--func/minion/modules/command.py13
1 files changed, 7 insertions, 6 deletions
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