summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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