Permalink
Browse files

Merged upstream to fix clobbering first half of update

  • Loading branch information...
2 parents 2b1e4c4 + 81dcf60 commit 3de16524014aff786b0a5e3dda3930b87eeb94e9 @schade schade committed Jan 10, 2013
Showing with 15 additions and 13 deletions.
  1. +3 −0 CHANGELOG.md
  2. +1 −1 VERSION
  3. +2 −2 ironfan.gemspec
  4. +8 −8 lib/ironfan/provider/ec2/elastic_ip.rb
  5. +1 −2 lib/ironfan/provider/ec2/machine.rb
View
@@ -1,3 +1,6 @@
+# v4.7.2
+* elastic_ip: ensuring that elastic IPs work with VPC instances (thanks @schade)
+
# v4.7.1
* Cleaning up omnibus usage to link embedded bin, ruby into default $PATHs, rather than use /etc/environment to try tweaking (doesn't hit a large number of programs)
* Launched machines should announce their state as "started"
View
@@ -1 +1 @@
-4.7.1
+4.7.2
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "ironfan"
- s.version = "4.7.1"
+ s.version = "4.7.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Infochimps"]
- s.date = "2012-12-20"
+ s.date = "2013-01-10"
s.description = "Ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
s.email = "coders@infochimps.com"
s.extra_rdoc_files = [
@@ -56,8 +56,8 @@ def self.load!(cluster=nil)
def self.save!(computer)
return unless computer.created?
- # instead of just returning if the elastic_ip is blank we first test if the symbol exists and whether an actual
- # address exists in the collection; All three require the presence of elastic_ip in the facet definition. We
+ return unless elastic_ip = computer.server.ec2.elastic_ip
+ return unless recall? elastic_ip
# also, in the case of VPC Elastic IPs, can discover and use allocation_id to attach a VPC Elastic IP.
return unless computer.server.ec2.include?(:elastic_ip)
if ( computer.server.ec2.elastic_ip.nil? and cloud.vpc.nil? )
@@ -75,7 +75,7 @@ def self.save!(computer)
end
elsif ( !computer.server.ec2.elastic_ip.nil? or cloud.vpc.nil? )
# Third, :elastic_ip is set, has an address available to use, has a set value in facet definition and is not VPC.
- elastic_ip = computer.server.ec2.elastic_ip
+ elastic_ip = computer.server.ec2.elastic_ip
Chef::Log.debug( "using requested Elastic IP address" )
elsif ( computer.server.ec2.elastic_ip.nil? and !cloud.vpc.nil? )
# Fourth, is exactly like Third but on a VPC domain. (this is functionaility for attaching VPC Elastic IPS)
@@ -88,11 +88,11 @@ def self.save!(computer)
Ironfan.step(computer.name, "associating Elastic IP #{elastic_ip}", :blue)
Ironfan.unless_dry_run do
Ironfan.safely do
- if cloud.vpc.nil?
- Ec2.connection.associate_address( computer.machine.id, public_ip = elastic_ip )
- else
- Ec2.connection.associate_address( computer.machine.id, allocation_id = allocation_id )
- end
+ vpc = computer.server.ec2.vpc
+ allocation_id = recall(elastic_ip).allocation_id
+ raise "#{elastic_ip} is only for non-VPC instances" if vpc and allocation_id.nil?
+ raise "#{elastic_ip} is only for VPC instances" if vpc.nil? and allocation_id
+ Ec2.connection.associate_address( computer.machine.id, elastic_ip, nil, allocation_id )
end
end
end
@@ -240,8 +240,7 @@ def self.launch_description(computer)
# VPC security_groups can only be addressed by id (not name)
description[:security_group_ids] = cloud.security_groups.keys.map do |g|
- group_name = cloud.vpc.nil? ? g.to_s : "#{cloud.vpc}:#{g}"
- SecurityGroup.recall(group_name).group_id
+ SecurityGroup.recall( SecurityGroup.group_name_with_vpc(g,cloud.vpc) ).group_id
end
description[:iam_server_certificates] = cloud.iam_server_certificates.values.map do |cert|

0 comments on commit 3de1652

Please sign in to comment.