Class/Module Index [+]

Quicksearch

Ironfan::Dsl::Ec2

Public Instance Methods

default_region() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 55
def default_region
  default_availability_zone ? default_availability_zone.gsub(/^(\w+-\w+-\d)[a-z]/, '\1') : nil
end
domain() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 37
def domain;                       vpc.nil? ? 'standard' : 'vpc';       end
flavor_info() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 70
def flavor_info
  if not Chef::Config[:ec2_flavor_info].has_key?(flavor)
    ui.warn("Unknown machine image flavor '#{flavor}'")
    list_flavors
    return nil
  end
  Chef::Config[:ec2_flavor_info][flavor]
end
image_id() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 47
def image_id
  result = read_attribute(:image_id) || image_info[:image_id]
end
image_info() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 39
def image_info
  bit_str = "#{self.bits.to_i}-bit" # correct for legacy image info.
  keys = [region, bit_str, backing, image_name]
  info = Chef::Config[:ec2_image_info][ keys ]
  ui.warn("Can't find image for #{[region, bit_str, backing, image_name].inspect}") if info.blank?
  return info || {}
end
implied_volumes() click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 79
def implied_volumes
  result = []
  if backing == 'ebs'
    result << Ironfan::Dsl::Volume.new(:name => 'root') do
      device              '/dev/sda1'
      fstype              'ext4'
      keep                false
      mount_point         '/'
    end
  end
  return result unless (mount_ephemerals and (flavor_info[:ephemeral_volumes] > 0))

  layout = {  0 => ['/dev/sdb','/mnt'],
              1 => ['/dev/sdc','/mnt2'],
              2 => ['/dev/sdd','/mnt3'],
              3 => ['/dev/sde','/mnt4']   }
  ( 0 .. (flavor_info[:ephemeral_volumes]-1) ).each do |idx|
    dev, mnt = layout[idx]
    ephemeral = Ironfan::Dsl::Volume.new(:name => "ephemeral#{idx}") do
      attachable          'ephemeral'
      fstype              'ext3'
      device              dev
      mount_point         mnt
      mount_options       'defaults,noatime'
      tags({:bulk => true, :local => true, :fallback => true})
    end
    ephemeral.receive! mount_ephemerals
    result << ephemeral
  end
  result
end
receive_provider(obj) click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 111
def receive_provider(obj)
  if obj.is_a?(String)
    write_attribute :provider, Gorillib::Inflector.constantize(Gorillib::Inflector.camelize(obj.gsub(/\./, '/')))
  else
    super(obj)
  end
end
ssh_key_name(computer) click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 51
def ssh_key_name(computer)
  keypair ? keypair.to_s : computer.server.cluster_name
end
to_display(style,values={}) click to toggle source
# File lib/ironfan/dsl/ec2.rb, line 59
def to_display(style,values={})
  return values if style == :minimal

  values["Flavor"] =            flavor
  values["AZ"] =                default_availability_zone
  return values if style == :default

  values["Public IP"] =        elastic_ip if elastic_ip
  values
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.