func/minion/modules/command.py | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/func/minion/modules/command.py b/func/minion/modules/command.py index 06adaaa..63d96c1 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@xxxxxxxxxx> +# Steve 'Ashcrow' Milner <smilner@xxxxxxxxxx> # # 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 -- 1.5.3.7 _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list