From 8a96a0d02de0226201c08b39b55819a68a1510ea Mon Sep 17 00:00:00 2001 From: Adam Bozanich Date: Tue, 12 Feb 2013 13:41:48 -0800 Subject: [PATCH 1/5] Enable ebs-optimized spot instance requests --- lib/fog/aws/models/compute/spot_request.rb | 2 ++ lib/fog/aws/requests/compute/request_spot_instances.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/fog/aws/models/compute/spot_request.rb b/lib/fog/aws/models/compute/spot_request.rb index afd73fb2c..84b05c520 100644 --- a/lib/fog/aws/models/compute/spot_request.rb +++ b/lib/fog/aws/models/compute/spot_request.rb @@ -21,6 +21,7 @@ module Fog attribute :availability_zone_group, :aliases => 'availabilityZoneGroup' attribute :product_description, :aliases => 'productDescription' + attribute :ebs_optimized, :aliases => 'LaunchSpecification.EbsOptimized' attribute :groups, :aliases => 'LaunchSpecification.SecurityGroup' attribute :key_name, :aliases => 'LaunchSpecification.KeyName' attribute :availability_zone, :aliases => 'LaunchSpecification.Placement.AvailabilityZone' @@ -95,6 +96,7 @@ module Fog 'LaunchSpecification.Monitoring.Enabled' => monitoring, 'LaunchSpecification.Placement.AvailabilityZone' => availability_zone, 'LaunchSpecification.SecurityGroup' => groups, + 'LaunchSpecification.EbsOptimized' => ebs_optimized, 'LaunchSpecification.UserData' => user_data, 'LaunchSpecification.SubnetId' => subnet_id, 'LaunchSpecification.IamInstanceProfile.Arn' => @iam_instance_profile_arn, diff --git a/lib/fog/aws/requests/compute/request_spot_instances.rb b/lib/fog/aws/requests/compute/request_spot_instances.rb index 684b18a13..2bfdf0c74 100644 --- a/lib/fog/aws/requests/compute/request_spot_instances.rb +++ b/lib/fog/aws/requests/compute/request_spot_instances.rb @@ -29,6 +29,7 @@ module Fog # * 'LaunchSpecification.SecurityGroup'<~Array> or <~String> - Name of security group(s) for instances, not supported in VPC # * 'LaunchSpecification.SecurityGroupId'<~Array> or <~String> - Id of security group(s) for instances, use this or LaunchSpecification.SecurityGroup # * 'LaunchSpecification.UserData'<~String> - Additional data to provide to booting instances + # * 'LaunchSpecification.EbsOptimized'<~Boolean> - Whether the instance is optimized for EBS I/O # * 'Type'<~String> - spot instance request type in ['one-time', 'persistent'] # * 'ValidFrom'<~Time> - start date for request # * 'ValidUntil'<~Time> - end date for request From 48e0d3f200eda4b0cee256773bdd8d01fbbdc4fa Mon Sep 17 00:00:00 2001 From: Adam Bozanich Date: Tue, 12 Feb 2013 14:34:48 -0800 Subject: [PATCH 2/5] test spot instance request parser --- lib/fog/aws/parsers/compute/spot_instance_requests.rb | 2 ++ tests/aws/requests/compute/spot_instance_tests.rb | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/parsers/compute/spot_instance_requests.rb b/lib/fog/aws/parsers/compute/spot_instance_requests.rb index efa4e674f..53454a0cb 100644 --- a/lib/fog/aws/parsers/compute/spot_instance_requests.rb +++ b/lib/fog/aws/parsers/compute/spot_instance_requests.rb @@ -52,6 +52,8 @@ module Fog end when 'imageId', 'instanceType', 'keyname', 'subnetId' @spot_instance_request['launchSpecification'][name] = value + when 'ebsOptimized' + @spot_instance_request['launchSpecification'][name] = value == 'true' when 'enabled' @spot_instance_request['launchSpecification']['monitoring'] = (value == 'true') when 'requestId' diff --git a/tests/aws/requests/compute/spot_instance_tests.rb b/tests/aws/requests/compute/spot_instance_tests.rb index 57c634897..9a65fdfcd 100644 --- a/tests/aws/requests/compute/spot_instance_tests.rb +++ b/tests/aws/requests/compute/spot_instance_tests.rb @@ -12,6 +12,7 @@ Shindo.tests('Fog::Compute[:aws] | spot instance requests', ['aws']) do 'imageId' => String, 'instanceType' => String, 'monitoring' => Fog::Boolean, + 'ebsOptimized' => Fog::Boolean, 'subnetId' => Fog::Nullable::String, 'iamInstanceProfile' => Fog::Nullable::Hash, }, @@ -38,13 +39,13 @@ Shindo.tests('Fog::Compute[:aws] | spot instance requests', ['aws']) do pending if Fog.mocking? tests("#request_spot_instances('ami-3202f25b', 't1.micro', '0.001')").formats(@spot_instance_requests_format) do - data = Fog::Compute[:aws].request_spot_instances('ami-3202f25b', 't1.micro', '0.001').body + data = Fog::Compute[:aws].request_spot_instances('ami-3202f25b', 't1.micro', '0.001',{'LaunchSpecification.EbsOptimized' => false}).body @spot_instance_request_id = data['spotInstanceRequestSet'].first['spotInstanceRequestId'] data end tests("#describe_spot_instance_requests").formats(@spot_instance_requests_format) do - Fog::Compute[:aws].describe_spot_instance_requests.body + Fog::Compute[:aws].describe_spot_instance_requests('spot-instance-request-id' => [@spot_instance_request_id]).body end tests("#cancel_spot_instance_requests('#{@spot_instance_request_id}')").formats(@cancel_spot_instance_request_format) do From fecbf150a4574a0080d5d454807a248f0b71d31a Mon Sep 17 00:00:00 2001 From: "Michael D. Hall" Date: Wed, 13 Feb 2013 07:03:09 -0600 Subject: [PATCH 3/5] Bumped net-scp dependency to ~>1.1 RubyGems.org yanked v1.0.6 causing problems with installing the gem. --- fog.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fog.gemspec b/fog.gemspec index 96b0793b7..d20713c61 100644 --- a/fog.gemspec +++ b/fog.gemspec @@ -45,7 +45,7 @@ Gem::Specification.new do |s| s.add_dependency('formatador', '~>0.2.0') s.add_dependency('multi_json', '~>1.0') s.add_dependency('mime-types') - s.add_dependency('net-scp', '~>1.0.4') + s.add_dependency('net-scp', '~>1.1') s.add_dependency('net-ssh', '>=2.1.3') s.add_dependency('nokogiri', '~>1.5.0') s.add_dependency('ruby-hmac') From 1978c8a1223571e3fc1477b5381f4c6c3d8756a9 Mon Sep 17 00:00:00 2001 From: Kyle Rames Date: Wed, 13 Feb 2013 10:37:33 -0600 Subject: [PATCH 4/5] [Rackspace|Storage] This tests consistently fails on either ruby 1.8.7 or ruby 1.9.3 because hash order is indeterminate. I believe the spirt of this test is to ensure that only one header value is generated and thus I have updated the test to reflect that. --- tests/rackspace/models/storage/file_tests.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/rackspace/models/storage/file_tests.rb b/tests/rackspace/models/storage/file_tests.rb index 62c8a2af0..5bd965aed 100644 --- a/tests/rackspace/models/storage/file_tests.rb +++ b/tests/rackspace/models/storage/file_tests.rb @@ -113,9 +113,11 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @instance.metadata['foo-bar'] = 'baz' @instance.metadata[:'foo_bar'] = 'bref' - tests("should only support one value per metadata key").returns('bref') do + tests("should only support one value per metadata key").returns(true) do @instance.save - object_meta_attributes['X-Object-Meta-Foo-Bar'] + metadata = object_meta_attributes + returns(1) { metadata.size } + metadata.has_key? 'X-Object-Meta-Foo-Bar' end end From 822b219bd3cc4cf6e0971280be4c174667020df0 Mon Sep 17 00:00:00 2001 From: Kyle Rames Date: Wed, 13 Feb 2013 12:18:52 -0600 Subject: [PATCH 5/5] [rackspace|storage] removing test of dubious distinction per geemus --- tests/rackspace/models/storage/file_tests.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/rackspace/models/storage/file_tests.rb b/tests/rackspace/models/storage/file_tests.rb index 5bd965aed..42190d3e1 100644 --- a/tests/rackspace/models/storage/file_tests.rb +++ b/tests/rackspace/models/storage/file_tests.rb @@ -110,15 +110,6 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - - @instance.metadata['foo-bar'] = 'baz' - @instance.metadata[:'foo_bar'] = 'bref' - tests("should only support one value per metadata key").returns(true) do - @instance.save - metadata = object_meta_attributes - returns(1) { metadata.size } - metadata.has_key? 'X-Object-Meta-Foo-Bar' - end end end