ironfan 4.5.2 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v4.6.0
2
+ * Elastic IP attachment and SSH support (changes ec2.public_ip to ec2.elastic_ip for clarity - thanks @schade)
3
+ * Expanded development dependencies, to allow avoiding bundler verbosity bug by rolling back to older version
4
+
1
5
  # v4.5.2:
2
6
  * 'knife cluster launch --bootstrap' should ensure that Chef::Config[:environment] is set, just as 'knife cluster bootstrap' does
3
7
  * Cleaning up knife commands to skip bogus servers (fixes #213)
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gem 'formatador', "~> 0.2"
6
6
  gem 'gorillib', "~> 0.4.2"
7
7
 
8
8
  group :development do
9
- gem 'bundler', "~> 1.1"
9
+ gem 'bundler', "~> 1.0"
10
10
  gem 'rake'
11
11
  gem 'rspec', "~> 2.8"
12
12
  gem 'yard', ">= 0.7"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.5.2
1
+ 4.6.0
data/config/knife.bash CHANGED
@@ -129,6 +129,11 @@ _knife() {
129
129
  COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
130
130
  return 0
131
131
  ;;
132
+ *knife_cluster_launch|*knife_cluster_show|*knife_cluster_edit)
133
+ _chef_completion_cache -c ${words[0]}_cluster "${words[0]} cluster list|awk '{ print $1 }'"
134
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
135
+ return 0
136
+ ;;
132
137
  *knife_environment_show|*knife_environment_edit|*knife_environment_delete)
133
138
  _chef_completion_cache -c ${words[0]}_environments "${words[0]} environment list|${SED} -r -e 's/[\"\ ,]//g' -e '/[^0-9A-Za-z._-]+/d'"
134
139
  COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
data/ironfan.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ironfan"
8
- s.version = "4.5.2"
8
+ s.version = "4.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Infochimps"]
12
- s.date = "2012-11-27"
12
+ s.date = "2012-12-10"
13
13
  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."
14
14
  s.email = "coders@infochimps.com"
15
15
  s.extra_rdoc_files = [
@@ -159,7 +159,7 @@ Gem::Specification.new do |s|
159
159
  s.add_runtime_dependency(%q<fog>, ["~> 1.2"])
160
160
  s.add_runtime_dependency(%q<formatador>, ["~> 0.2"])
161
161
  s.add_runtime_dependency(%q<gorillib>, ["~> 0.4.2"])
162
- s.add_development_dependency(%q<bundler>, ["~> 1.1"])
162
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
163
163
  s.add_development_dependency(%q<rake>, [">= 0"])
164
164
  s.add_development_dependency(%q<rspec>, ["~> 2.8"])
165
165
  s.add_development_dependency(%q<yard>, [">= 0.7"])
@@ -171,7 +171,7 @@ Gem::Specification.new do |s|
171
171
  s.add_dependency(%q<fog>, ["~> 1.2"])
172
172
  s.add_dependency(%q<formatador>, ["~> 0.2"])
173
173
  s.add_dependency(%q<gorillib>, ["~> 0.4.2"])
174
- s.add_dependency(%q<bundler>, ["~> 1.1"])
174
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
175
175
  s.add_dependency(%q<rake>, [">= 0"])
176
176
  s.add_dependency(%q<rspec>, ["~> 2.8"])
177
177
  s.add_dependency(%q<yard>, [">= 0.7"])
@@ -184,7 +184,7 @@ Gem::Specification.new do |s|
184
184
  s.add_dependency(%q<fog>, ["~> 1.2"])
185
185
  s.add_dependency(%q<formatador>, ["~> 0.2"])
186
186
  s.add_dependency(%q<gorillib>, ["~> 0.4.2"])
187
- s.add_dependency(%q<bundler>, ["~> 1.1"])
187
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
188
188
  s.add_dependency(%q<rake>, [">= 0"])
189
189
  s.add_dependency(%q<rspec>, ["~> 2.8"])
190
190
  s.add_dependency(%q<yard>, [">= 0.7"])
@@ -87,7 +87,6 @@ class Chef
87
87
  section("Launching computers", :green)
88
88
  display(target)
89
89
  launched = target.launch
90
-
91
90
  # As each server finishes, configure it
92
91
  Ironfan.parallel(launched) do |computer|
93
92
  if (computer.is_a?(Exception)) then ui.warn "Error launching #{computer.inspect}; skipping after-launch tasks."; next; end
@@ -107,7 +106,7 @@ class Chef
107
106
  Ironfan.step(computer.name, 'waiting for ready', :white)
108
107
  # Wait for machine creation on amazon side
109
108
  computer.machine.wait_for{ ready? }
110
-
109
+
111
110
  # Try SSH
112
111
  unless config[:dry_run]
113
112
  Ironfan.step(computer.name, 'trying ssh', :white)
@@ -116,7 +115,7 @@ class Chef
116
115
 
117
116
  Ironfan.step(computer.name, 'final provisioning', :white)
118
117
  computer.save
119
-
118
+
120
119
  # Run Bootstrap
121
120
  if config[:bootstrap]
122
121
  Chef::Log.warn "UNTESTED --bootstrap"
@@ -25,7 +25,7 @@ module Ironfan
25
25
  magic :permanent, :boolean, :default => false
26
26
  magic :placement_group, String
27
27
  magic :provider, Whatever, :default => Ironfan::Provider::Ec2
28
- magic :public_ip, String
28
+ magic :elastic_ip, String
29
29
  magic :region, String, :default => ->{ default_region }
30
30
  collection :security_groups, Ironfan::Dsl::Ec2::SecurityGroup, :key_method => :name
31
31
  magic :ssh_user, String, :default => ->{ image_info[:ssh_user] }
@@ -34,6 +34,8 @@ module Ironfan
34
34
  magic :validation_key, String, :default => ->{ IO.read(Chef::Config.validation_key) rescue '' }
35
35
  magic :vpc, String
36
36
 
37
+ def domain; vpc.nil? ? 'standard' : 'vpc'; end
38
+
37
39
  def image_info
38
40
  bit_str = "#{self.bits.to_i}-bit" # correct for legacy image info.
39
41
  keys = [region, bit_str, backing, image_name]
@@ -61,7 +63,7 @@ module Ironfan
61
63
  values["AZ"] = default_availability_zone
62
64
  return values if style == :default
63
65
 
64
- values["Elastic IP"] = public_ip if public_ip
66
+ values["Public IP"] = elastic_ip if elastic_ip
65
67
  values
66
68
  end
67
69
 
@@ -277,8 +279,8 @@ Chef::Config[:ec2_flavor_info].merge!({
277
279
  # 32-or-64: m1.small, m1.medium, t1.micro, c1.medium
278
280
  't1.micro' => { :price => 0.02, :bits => 64, :ram => 686, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 0, :ephemeral_volumes => 0 },
279
281
  'm1.small' => { :price => 0.08, :bits => 64, :ram => 1740, :cores => 1, :core_size => 1, :inst_disks => 1, :inst_disk_size => 160, :ephemeral_volumes => 1 },
280
- 'm1.medium' => { :price => 0.165, :bits => 32, :ram => 3840, :cores => 2, :core_size => 1, :inst_disks => 1, :inst_disk_size => 410, :ephemeral_volumes => 1 },
281
- 'c1.medium' => { :price => 0.17, :bits => 32, :ram => 1740, :cores => 2, :core_size => 2.5, :inst_disks => 1, :inst_disk_size => 350, :ephemeral_volumes => 1 },
282
+ 'm1.medium' => { :price => 0.165, :bits => 64, :ram => 3840, :cores => 2, :core_size => 1, :inst_disks => 1, :inst_disk_size => 410, :ephemeral_volumes => 1 },
283
+ 'c1.medium' => { :price => 0.17, :bits => 64, :ram => 1740, :cores => 2, :core_size => 2.5, :inst_disks => 1, :inst_disk_size => 350, :ephemeral_volumes => 1 },
282
284
  #
283
285
  'm1.large' => { :price => 0.32, :bits => 64, :ram => 7680, :cores => 2, :core_size => 2, :inst_disks => 2, :inst_disk_size => 850, :ephemeral_volumes => 2 },
284
286
  'm2.xlarge' => { :price => 0.45, :bits => 64, :ram => 18124, :cores => 2, :core_size => 3.25, :inst_disks => 1, :inst_disk_size => 420, :ephemeral_volumes => 1 },
@@ -3,6 +3,63 @@ module Ironfan
3
3
  class Ec2
4
4
 
5
5
  class ElasticIp < Ironfan::Provider::Resource
6
+ delegate :addresses, :associate_address, :allocation_id,
7
+ :allocation_id=, :destroy, :domain, :domain=,
8
+ :describe_addresses, :disassociate_address, :domain, :id,
9
+ :network_interface_id, :network_interface_id=, :public_ip,
10
+ :public_ip=, :public_ip_address, :save, :server=, :server, :server_id,
11
+ :server_id=,
12
+ :to => :adaptee
13
+
14
+ def self.shared?() true; end
15
+ def self.multiple?() false; end
16
+ def self.resource_type() :elastic_ip; end
17
+ def self.expected_ids(computer) [ computer.server.ec2.elastic_ip ]; end
18
+ def name() adaptee.public_ip ; end
19
+
20
+ #
21
+ # Discovery
22
+ #
23
+
24
+ def self.load!(cluster=nil)
25
+ Ec2.connection.addresses.each do |eip|
26
+ register eip
27
+ Chef::Log.debug("Loaded #{eip}")
28
+
29
+ # The rest of this definition shows relevant information when -VV
30
+ # is passed to knife and aids in troubleshooting any refusal to
31
+ # attach Elastic IPs
32
+ Chef::Log.debug( "AWS domain: #{eip.domain}" )
33
+ Chef::Log.debug( "available ip match: #{eip.public_ip}" )
34
+ Chef::Log.debug( "----------------------" )
35
+ end
36
+
37
+ cluster.servers.each do |s|
38
+ next if s.ec2.elastic_ip.nil?
39
+ if recall? s.ec2.elastic_ip
40
+ Chef::Log.debug( "Cluster elastic_ip matches #{s.ec2.elastic_ip}" )
41
+ else
42
+ Chef::Log.debug( "No matching Elastic IP for #{s.ec2.elastic_ip}" )
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ #
49
+ # Manipulation
50
+ #
51
+
52
+ def self.save!(computer)
53
+ return unless computer.created?
54
+ elastic_ip = computer.server.ec2.elastic_ip
55
+ Ironfan.step(computer.name, "associating Elastic IP #{elastic_ip}", :blue)
56
+ Ironfan.unless_dry_run do
57
+ Ironfan.safely do
58
+ Ec2.connection.associate_address( computer.machine.id, elastic_ip )
59
+ end
60
+ end
61
+ end
62
+
6
63
  end
7
64
  end
8
65
  end
@@ -71,8 +71,8 @@ module Ironfan
71
71
  def to_display(style,values={})
72
72
  # style == :minimal
73
73
  values["State"] = state.to_sym
74
- values["MachineID"] = id
75
- values["Public IP"] = public_ip_address
74
+ values["MachineID"] = id
75
+ values["Public IP"] = public_ip_address
76
76
  values["Private IP"] = private_ip_address
77
77
  values["Created On"] = created_at.to_date
78
78
  return values if style == :minimal
@@ -163,7 +163,7 @@ module Ironfan
163
163
 
164
164
  fog_server.wait_for { ready? }
165
165
  end
166
-
166
+
167
167
  # tag the computer correctly
168
168
  tags = {
169
169
  'cluster' => computer.server.cluster_name,
@@ -224,7 +224,6 @@ module Ironfan
224
224
  :client_key => computer.private_key
225
225
  }
226
226
 
227
-
228
227
  # Fog does not actually create tags when it creates a server;
229
228
  # they and permanence are applied during sync
230
229
  description = {
@@ -236,7 +235,7 @@ module Ironfan
236
235
  :user_data => JSON.pretty_generate(user_data_hsh),
237
236
  :block_device_mapping => block_device_mapping(computer),
238
237
  :availability_zone => cloud.default_availability_zone,
239
- :monitoring => cloud.monitoring,
238
+ :monitoring => cloud.monitoring
240
239
  }
241
240
 
242
241
  # VPC security_groups can only be addressed by id (not name)
@@ -5,7 +5,7 @@ module Ironfan
5
5
  self.handle = :ec2
6
6
 
7
7
  def self.resources
8
- [ Machine, EbsVolume, Keypair, SecurityGroup, IamServerCertificate, ElasticLoadBalancer ]
8
+ [ Machine, ElasticIp, EbsVolume, Keypair, SecurityGroup, IamServerCertificate, ElasticLoadBalancer ]
9
9
  end
10
10
 
11
11
  #
@@ -35,6 +35,7 @@ require 'ironfan/provider/ec2/machine'
35
35
  require 'ironfan/provider/ec2/keypair'
36
36
  require 'ironfan/provider/ec2/placement_group'
37
37
  require 'ironfan/provider/ec2/security_group'
38
+ require 'ironfan/provider/ec2/elastic_ip'
38
39
  require 'ironfan/provider/ec2/elastic_load_balancer'
39
40
  require 'ironfan/provider/ec2/iam_server_certificate'
40
41
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.5.2
5
+ version: 4.6.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Infochimps
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-11-27 00:00:00 Z
13
+ date: 2012-12-10 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -63,7 +63,7 @@ dependencies:
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: "1.1"
66
+ version: "1.0"
67
67
  type: :development
68
68
  prerelease: false
69
69
  version_requirements: *id005
@@ -282,7 +282,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
282
282
  requirements:
283
283
  - - ">="
284
284
  - !ruby/object:Gem::Version
285
- hash: -2019769305702491484
285
+ hash: 852641782285257729
286
286
  segments:
287
287
  - 0
288
288
  version: "0"