Class: Bcome::Orchestrator::NodeTarget::AllExcludingRoles

Inherits:
Base
  • Object
show all
Defined in:
lib/orchestrator/node_target/all_excluding_roles.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
10
11
# File 'lib/orchestrator/node_target/all_excluding_roles.rb', line 4

def set_machines(machines)
  exclusion_roles = @selectors[:exclusion_roles]
  raise "No exclusion roles set for node target of type all_excluding_roles" unless exclusion_roles

  @node_selections = machines.select{|machine|
    !exclusion_roles.include?(machine.role)
  }
end