1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Added a run class method to command executers

git-svn-id: http://svn.opennebula.org/one/trunk@349 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Javier Fontán Muiños 2009-02-10 17:55:23 +00:00
parent 2908d083e3
commit 27ba9de530

View File

@ -9,6 +9,13 @@ class GenericCommand
attr_accessor :value, :code, :stdout, :stderr, :command
attr_accessor :callback
# Creates a command and runs it
def self.run(command, logger=nil)
cmd=self.new(command, logger)
cmd.run
cmd
end
# Creates the new command:
# +command+: string with the command to be executed
def initialize(command, logger=nil)
@ -87,6 +94,13 @@ end
# for GenericCommand
class SSHCommand < GenericCommand
attr_accessor :host
# Creates a command and runs it
def self.run(command, host, logger=nil)
cmd=self.new(command, host, logger)
cmd.run
cmd
end
# This one takes another parameter. +host+ is the machine
# where de command is going to be executed