lib/cloud_providers/ec2/ec2.rb
# Describe instances
# Describe the instances that are available on this cloud
# @params id (optional) if present, details about the instance
# with the id given will be returned
# if not given, details for all instances will be returned
Describe instances
Describe the instances that are available on this cloud
Describe instances Describe the instances that are available on this cloud
def describe_instances(id=nil)
      begin
        @describe_instances = ec2.describe_instances.reservationSet.item.map do |r|
          r.instancesSet.item.map do |i|
            inst_options = i.merge(r.merge(:cloud => cloud)).merge(cloud.cloud_provider.dsl_options)
            Ec2Instance.new(inst_options)
          end
        end.flatten
      rescue AWS::InvalidClientTokenId => e 
        puts "Error contacting AWS: #{e}"
        raise e
      rescue Exception => e
        []
      end
    end
def describe_instances ( id = nil ) begin @describe_instances = ec2 . describe_instances . reservationSet . item . map do | r | r . instancesSet . item . map do | i | inst_options = i . merge ( r . merge ( :cloud => cloud ) ) . merge ( cloud . cloud_provider . dsl_options ) Ec2Instance . new ( inst_options ) end end . flatten rescue AWS :: InvalidClientTokenId => e puts "Error contacting AWS: #{e}" raise e rescue Exception => e [ ] end end
Describe instances
Describe the instances that are available on this cloud
Describe instances Describe the instances that are available on this cloud
# AWS credentials invalid
id
params
id (optional) if present, details about the instance with the id given will be returned if not given, details for all instances will be returned
id ( optional ) if present details about the instance with the id given will be returned if not given details for all instances will be returned