class Dopi::CommandSet

Attributes

node[R]
plan[R]
step[R]

Public Class Methods

new(step_parser, step, node) click to toggle source
# File lib/dopi/command_set.rb, line 14
def initialize(step_parser, step, node)
  @step_parser = step_parser
  @step = step
  @plan = step.plan
  @node = node

  commands.each{|command| state_add_child(command)}
end

Public Instance Methods

commands() click to toggle source
# File lib/dopi/command_set.rb, line 27
def commands
  @commands ||= @step_parser.commands.map do |command|
    Dopi::Command.create_plugin_instance(command, @step, node)
  end
end
load_state(state_hash) click to toggle source
# File lib/dopi/command_set.rb, line 50
def load_state(state_hash)
  return if state_hash.empty?
  commands.each_with_index do |command, i|
    command.load_state(state_hash[i])
  end
end
name() click to toggle source
# File lib/dopi/command_set.rb, line 23
def name
  @node.name
end
run(noop) click to toggle source
# File lib/dopi/command_set.rb, line 42
def run(noop)
  commands.each do |command|
    break if state_failed? or signals[:stop]
    command.meta_run(noop)
    break unless command.state_done?
  end
end
state_hash() click to toggle source
# File lib/dopi/command_set.rb, line 57
def state_hash
  commands.map do |command|
    command.state_hash
  end
end
valid?() click to toggle source
# File lib/dopi/command_set.rb, line 33
def valid?
  begin
    commands.all?{|command| command.meta_valid?}
  rescue PluginLoaderError => e
    Dopi.log.error("Step '#{name}': Can't load plugin : #{e.message}")
    false
  end
end