Class: Cloudfinder::EC2::Clusterfinder
- Inherits:
-
Object
- Object
- Cloudfinder::EC2::Clusterfinder
- Defined in:
- lib/cloudfinder-ec2/clusterfinder.rb
Instance Method Summary collapse
-
#find(query) ⇒ Cloudfinder::EC2::Cluster
Find all the running instances for a named cluster and build them into a cluster object, grouped by role.
Instance Method Details
#find(query) ⇒ Cloudfinder::EC2::Cluster
Find all the running instances for a named cluster and build them into a cluster object, grouped by role.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cloudfinder-ec2/clusterfinder.rb', line 12 def find(query) validate_arguments(query) @cluster_name = query[:cluster_name] instances = [] each_running_instance(query[:region]) do |instance_data| if in_cluster?(instance_data) && has_role?(instance_data) instances << new_instance(instance_data) end end Cloudfinder::EC2::Cluster.new( cluster_name: @cluster_name, instances: instances ) end |