Class/Module Index [+]

Quicksearch

Ironfan::Provider::Ec2::Keypair

Public Class Methods

expected_ids(computer) click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 18
def self.expected_ids(computer)
  [computer.server.cluster_name]
end
key_dir() click to toggle source

Utility

# File lib/ironfan/provider/ec2/keypair.rb, line 68
def self.key_dir
  return Chef::Config.ec2_key_dir if Chef::Config.ec2_key_dir
  dir = "#{ENV['HOME']}/.chef/credentials/ec2_keys"
  warn "Please set 'ec2_key_dir' in your knife.rb. Will use #{dir} as a default"
  dir
end
load!(cluster=nil) click to toggle source

Discovery

# File lib/ironfan/provider/ec2/keypair.rb, line 37
def self.load!(cluster=nil)
  Ec2.connection.key_pairs.each do |keypair|
    register keypair unless keypair.blank?
    Chef::Log.debug("Loaded <%-15s %s>" % [handle, keypair.name])
  end
end
multiple?() click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 16
def self.multiple?     ; false    ; end
prepare!(computers) click to toggle source

Manipulation

# File lib/ironfan/provider/ec2/keypair.rb, line 53
def self.prepare!(computers)
  return if computers.empty?
  name = computers.values[0].server.cluster_name
  return if recall? name
  Ironfan.step(name, "creating key pair for #{name}", :blue)
  result = Ec2.connection.create_key_pair(name)
  private_key = result.body["keyMaterial"]
  load!  # Reload to get the native object
  recall(name).private_key = private_key
end
resource_type() click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 17
def self.resource_type ; :keypair ; end
shared?() click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 15
def self.shared?       ; true     ; end

Public Instance Methods

private_key() click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 22
def private_key
  File.open(key_filename, "rb").read
end
private_key=(body=nil) click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 26
def private_key=(body=nil)
  File.open(key_filename, "w", 0600){|f| f.print( body ) }
end
receive_adaptee(obj) click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 44
def receive_adaptee(obj)
  obj = Ec2.connection.key_pairs.new(obj) if obj.is_a?(Hash)
  super
end
to_s() click to toggle source
# File lib/ironfan/provider/ec2/keypair.rb, line 30
def to_s
  "<%-15s %-12s>" % [self.class.handle, name]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.