summaryrefslogtreecommitdiffstats
path: root/func/minion/modules/command.py
diff options
context:
space:
mode:
Diffstat (limited to 'func/minion/modules/command.py')
-rw-r--r--func/minion/modules/command.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/func/minion/modules/command.py b/func/minion/modules/command.py
index 06adaaa..c849d42 100644
--- a/func/minion/modules/command.py
+++ b/func/minion/modules/command.py
@@ -1,5 +1,6 @@
# Copyright 2007, Red Hat, Inc
# James Bowes <jbowes@redhat.com>
+# Steve 'Ashcrow' Milner <smilner@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
@@ -20,7 +21,8 @@ class Command(func_module.FuncModule):
def __init__(self):
self.methods = {
- "run" : self.run
+ "run" : self.run,
+ "exists" : self.exists,
}
func_module.FuncModule.__init__(self)
@@ -34,5 +36,16 @@ class Command(func_module.FuncModule):
data = cmdref.communicate()
return (cmdref.returncode, data[0], data[1])
+ def exists(self, command):
+ """
+ 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:
+ return True
+ return False
+
+
methods = Command()
register_rpc = methods.register_rpc