From 27ba9de53026179b1ae8ce796689e377f3776d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Font=C3=A1n=20Mui=C3=B1os?= Date: Tue, 10 Feb 2009 17:55:23 +0000 Subject: [PATCH] Added a run class method to command executers git-svn-id: http://svn.opennebula.org/one/trunk@349 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/mad/ruby/CommandManager.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mad/ruby/CommandManager.rb b/src/mad/ruby/CommandManager.rb index 5339533ffb..20c7416bc9 100644 --- a/src/mad/ruby/CommandManager.rb +++ b/src/mad/ruby/CommandManager.rb @@ -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