Class: Bcome::Orchestrator::NodeTarget::Single

Inherits:
Base
  • Object
show all
Defined in:
lib/orchestrator/node_target/single.rb

Instance Attribute Summary

Attributes inherited from Base

#node_selections, #target_key

Instance Method Summary collapse

Methods inherited from Base

#initialize, #json_attributes, klass_for_type, new_of_type_from, #override_validate_and_set?

Methods included from ValidateAndSet

#validate_and_set

Constructor Details

This class inherits a constructor from Bcome::Orchestrator::NodeTarget::Base

Instance Method Details

#set_machines(machines) ⇒ Object



4
5
6
7
8
9
# File 'lib/orchestrator/node_target/single.rb', line 4

def set_machines(machines)
  machine_role = @selectors[:role]
  raise "No machine role set for node target of type single" unless machine_role
  @node_selections = machines.select{|machine| machine.role == machine_role }
  raise "Multiple machines found with role #{machine_role}. Selection is ambiguous. Maybe you meant to use the 'all_with_roles' node_target type?" if @node_selections.size > 1
end