Skip to content
Browse files

Added basic kernel ID support to run_instances method. Thanks to Keit…

…h Hudgins for the patch.
  • Loading branch information...
1 parent 774f187 commit 24bbcc9047091b4c3cb79e3691858e6b1c5d6313 @grempe committed
Showing with 12 additions and 1 deletion.
  1. +3 −0 CHANGELOG
  2. +1 −1 amazon-ec2.gemspec
  3. +3 −0 lib/EC2/instances.rb
  4. +5 −0 test/test_EC2_instances.rb
View
3 CHANGELOG
@@ -1,3 +1,6 @@
+=== 0.3.1 2008-09-18
+ * Added basic custom kernel id support to run_instances. Thanks to Keith Hudgins for the patch.
+
=== 0.3.0 2008-08-24
* Changed response object from AmazonEC2::Response to Hash (patch from Yan Pritzker 'skwp') Thanks!
* Added support for Elastic Block Storage (patch from Yann Klis 'yannski') Thanks!
View
2 amazon-ec2.gemspec
@@ -1,5 +1,5 @@
GEM = "amazon-ec2"
-VER = "0.3.0"
+VER = "0.3.1"
AUTHOR = "Glenn Rempe"
EMAIL = "glenn.rempe@gmail.com"
HOMEPAGE = "http://github.com/grempe/amazon-ec2/"
View
3 lib/EC2/instances.rb
@@ -64,6 +64,7 @@ class Base
# :user_data => String (default : nil)
# :addressing_type => String (default : "public")
# :instance_type => String (default : "m1.small")
+ # :kernel_id => String (default : nil)
# :availability_zone => String (default : nil)
# :base64_encoded => Boolean (default : false)
#
@@ -77,6 +78,7 @@ def run_instances( options = {} )
:user_data => nil,
:addressing_type => "public",
:instance_type => "m1.small",
+ :kernel_id => nil,
:availability_zone => nil,
:base64_encoded => false }.merge(options)
@@ -111,6 +113,7 @@ def run_instances( options = {} )
params["UserData"] = user_data unless user_data.nil?
params["AddressingType"] = options[:addressing_type]
params["InstanceType"] = options[:instance_type]
+ params["KernelId"] = options[:kernel_id] unless options[:kernel_id].nil?
params["Placement.AvailabilityZone"] = options[:availability_zone] unless options[:availability_zone].nil?
return response_generator(:action => "RunInstances", :params => params)
View
5 test/test_EC2_instances.rb
@@ -232,6 +232,11 @@
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :group_id => [], :user_data => "foo", :base64_encoded => true ).should.be.an.instance_of Hash
end
+ specify "should be able specify an kernel_id" do
+ @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Placement.AvailabilityZone" => "zone123", "UserData" => "foo", "AddressingType" => 'public', 'InstanceType' => 'm1.small', 'KernelId' => 'kernfoo').
+ returns stub(:body => @run_instances_response_body, :is_a? => true)
+ @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :availability_zone => "zone123", :group_id => [], :user_data => "foo", :base64_encoded => true, :kernel_id => 'kernfoo' ).should.be.an.instance_of Hash
+ end
specify "should be able to call run_instances with :user_data and :base64_encoded => false" do
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "UserData" => "Zm9v", "AddressingType" => 'public', 'InstanceType' => 'm1.small').

0 comments on commit 24bbcc9

Please sign in to comment.
Something went wrong with that request. Please try again.