Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ensure that ec2 options are passed to ec2 gem.

  • Loading branch information...
commit 7903debb42582a955a08cbaecae85736ef08b769 1 parent 3fc79b3
@fairchild fairchild authored
View
1  .gitignore
@@ -1,3 +1,4 @@
+rdoc/*
.com.apple.timemachine.supported
.DS_Store
*tmp*
View
1  bin/cloud-list
@@ -10,7 +10,6 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
end
o.loaded_clouds.each do |cld|
-
puts header("Listing cloud #{cld.name}")
puts subheader("Active instances")
View
1  lib/poolparty/net/remoter_base.rb
@@ -85,7 +85,6 @@ def describe_instances(o={})
def self.launch_instance!(o={}, &block)
@cloud = o.delete(:cloud) if o[:cloud]
@keypair = o.delete(:keypair) if o[:keypair]
-
@inst = launch_new_instance!( o.merge(:keypair => @keypair.to_s) )
sleep(2)
View
40 lib/poolparty/net/remoter_bases/ec2/ec2.rb
@@ -43,23 +43,27 @@ def initialize(par, opts={}, &block)
super(par, &block)
end
- def self.launch_new_instance!(o = options)
- new(o).launch_new_instance!
+ # Requires a hash of options
+ def self.launch_new_instance!(o )
+ new(o).launch_new_instance!(o)
end
# TODO: Fix the key_name issue
- def launch_new_instance!(o={})
+ # Start a new instance with the given options
+ def launch_new_instance!(o)
raise "You must pass a keypair to launch an instance, or else you wont be able to login. options = #{o.inspect}" if !@cloud.keypair
- instance = ec2(o).run_instances(
- :image_id => ami,
- :user_data => options[:user_data],
- :minCount => 1,
- :maxCount => options[:num] || 1,
- :key_name => ::File.basename(keypair.is_a?(String) ? keypair : keypair.full_filepath),
- :availability_zone => availabilty_zone,
- :instance_type => options[:size] || Default.size,
- :group_id => security_group)
-
+ o.merge!( :image_id => ami,
+ :user_data => options[:user_data],
+ :min_count => 1,
+ :max_count => options[:num] || 1,
+ :key_name => ::File.basename(keypair.is_a?(String) ? keypair : keypair.full_filepath),
+ :availability_zone => availabilty_zone,
+ :instance_type => options[:size] || Default.size,
+ :group_id => security_group,
+ :addressing_type => "public",
+ :kernel_id => nil
+ )
+ instance = ec2(o).run_instances(o)
begin
h = EC2ResponseObject.get_hash_from_response(instance.instancesSet.item.first)
#h = instance.instancesSet.item.first
@@ -97,11 +101,16 @@ def describe_instances(o={})
end.compact.sort {|a,b| a[:index] <=> b[:index] }
end
+ # EC2 connections
+ def ec2(o={})
+ @ec2 ||= self.class.ec2(o)
+ end
def self.ec2(o={})
@ec2 ||= EC2::Base.new( :access_key_id => o[:access_key],
:secret_access_key => o[:secret_access_key]
)
end
+
# Get the ec2 description for the response in a hash format
def get_instances_description(o={})
key_hash = {:keypair => ::File.basename(keypair.is_a?(String) ? keypair : keypair.full_filepath)}
@@ -178,11 +187,6 @@ def create_snapshot
ec2.create_snapshot(:volume_id => ebs_volume_id)
end
- # EC2 connections
- def ec2(o={})
- @ec2 ||= self.class.ec2(o)
- end
-
# These are tasks that run before the configuration runs
def before_configuration_tasks
if set_master_ip_to && master.ip && master.ip.to_s != set_master_ip_to.to_s
Please sign in to comment.
Something went wrong with that request. Please try again.