class MotherBrain::CommandInvoker::Worker
Attributes
command[R]
@return [MB::Command]
environment[R]
@return [String]
node_filter[R]
@return [Array]
Public Class Methods
new(command, environment, node_filter = nil)
click to toggle source
@param [MB::Command] command
command to invoke
@param [String] environment
environment to invoke this command on
@param [Array] node_filter
= nil
list of nodes to limit the command to
# File lib/mb/command_invoker/worker.rb, line 19 def initialize(command, environment, node_filter = nil) @command = command @environment = environment @node_filter = node_filter end
Public Instance Methods
run(job, arguments = Array.new)
click to toggle source
@param [MB::Job] job @param [Array] arguments
# File lib/mb/command_invoker/worker.rb, line 27 def run(job, arguments = Array.new) arguments ||= Array.new msg = "Invoking #{command.type} command #{command.scope.name} #{command.name} on #{environment}" msg << " with arguments: #{arguments}" if arguments.any? job.set_status(msg) command.invoke(job, environment, node_filter, *arguments) rescue RemoteCommandError => ex abort(ex) end