ironfan 4.8.2 → 4.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v4.8.3
2
+ * Bogus servers should not be killable (fixes #250)
3
+ * Style guide corrections ('&&', not 'and'; don't use single-letter variable names)
4
+ * Also fixed a thing where security groups enumeration would die if a bogus server existed that's bit me before
5
+ * Reviewed other knife cluster commands and made them not tolerate bogosity either
6
+
1
7
  # v4.8.2
2
8
  * Launch EBS-optimized boxen on EC2
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.8.2
1
+ 4.8.3
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.8.2"
8
+ s.version = "4.8.3"
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 = "2013-02-21"
12
+ s.date = "2013-02-26"
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 = [
@@ -62,7 +62,6 @@ class Chef
62
62
  ensure_common_environment(target)
63
63
  # Execute across all servers in parallel
64
64
  Ironfan.parallel(target.values) {|computer| run_bootstrap(computer)}
65
- # threads = target.servers.map{ |server| Thread.new(server) { |svr| run_bootstrap(svr, svr.public_hostname) } }
66
65
  end
67
66
 
68
67
  def confirm_execution(target)
@@ -24,7 +24,7 @@ class Chef
24
24
  import_banner_and_options(Ironfan::Script)
25
25
 
26
26
  def relevant?(server)
27
- server.stopped?
27
+ (not bogus?) && stopped?
28
28
  end
29
29
 
30
30
  def perform_execution(target)
@@ -24,7 +24,7 @@ class Chef
24
24
  import_banner_and_options(Ironfan::Script)
25
25
 
26
26
  def relevant?(server)
27
- server.running?
27
+ (not bogus?) && server.running?
28
28
  end
29
29
 
30
30
  def perform_execution(target)
@@ -84,19 +84,18 @@ module Ironfan
84
84
  #
85
85
  def get_relevant_slice( *predicate )
86
86
  full_target = get_slice( *predicate )
87
- display(full_target) do |m|
88
- rel = relevant?(m)
89
- { :relevant? => (rel ? "[blue]#{rel}[reset]" : '-' ) }
87
+ display(full_target) do |mach|
88
+ rel = relevant?(mach)
89
+ { :relevant? => (rel ? "[green]#{rel}[reset]" : '-' ) }
90
90
  end
91
- full_target.select{|m| relevant?(m) }
91
+ full_target.select{|mach| relevant?(mach) }
92
92
  end
93
93
 
94
94
  # passes target to Broker::Conductor#display, will show headings in server slice
95
95
  # tables based on the --verbose flag
96
96
  def display(target, display_style=nil, &block)
97
97
  display_style ||= (config[:verbosity] == 0 ? :default : :expanded)
98
- # target.display(ui, display_style, &block)
99
- broker.display(target, display_style)
98
+ broker.display(target, display_style, &block)
100
99
  end
101
100
 
102
101
  #
@@ -17,11 +17,11 @@ module Ironfan
17
17
  super
18
18
  providers[:chef] ||= Ironfan::Provider::ChefServer
19
19
  return unless server
20
- providers[:iaas] = server.selected_cloud.provider
21
- volumes = server.volumes.values
22
- volumes += server.implied_volumes
23
- volumes.each { |v| self.drive v.name, :volume => v }
24
- rescue StandardError => err ; err.polish("#{self.class} on #{args}'") rescue nil ; raise
20
+ providers[:iaas] = server.selected_cloud.provider
21
+ volumes = server.volumes.values
22
+ volumes += server.implied_volumes
23
+ volumes.each{|vol| self.drive vol.name, :volume => vol }
24
+ rescue StandardError => err ; err.polish("#{self.class} on '#{args.inspect}'") rescue nil ; raise
25
25
  end
26
26
 
27
27
  def name
@@ -38,11 +38,11 @@ module Ironfan
38
38
  res.expected_ids(self).each do |id|
39
39
  next unless res.recall? id
40
40
 
41
- recalled = res.recall id
42
- recalled.users << self
41
+ recalled = res.recall id
42
+ recalled.users << self
43
43
 
44
- target = res.resource_type.to_s
45
- target += "__#{id}" if res.multiple?
44
+ target = res.resource_type.to_s
45
+ target += "__#{id}" if res.multiple?
46
46
  self[target.to_sym] = recalled
47
47
 
48
48
  recalled.on_correlate(self)
@@ -130,14 +130,6 @@ module Ironfan
130
130
  @chef_client_script_content = Ironfan.safely{ File.read(script_filename) }
131
131
  end
132
132
 
133
- # def ensure_resource(type)
134
- # if type.multiple?
135
- # existing = resources[type.resource_id]
136
- # else
137
- #
138
- # end
139
- # end
140
-
141
133
  #
142
134
  # Display
143
135
  #
@@ -200,7 +192,7 @@ module Ironfan
200
192
  self[:machine] = value
201
193
  end
202
194
  def dns_name ; machine? ? machine.dns_name : nil ; end
203
- def bootstrap_distro ; (server && server.selected_cloud) ? server.selected_cloud.bootstrap_distro : nil ; end
195
+ def bootstrap_distro ; (server && server.selected_cloud) ? server.selected_cloud.bootstrap_distro : nil ; end
204
196
 
205
197
  def keypair
206
198
  resources[:keypair]
@@ -225,16 +217,16 @@ module Ironfan
225
217
  not client.nil?
226
218
  end
227
219
  def created?
228
- machine? and machine.created?
220
+ machine? && machine.created?
229
221
  end
230
222
  def machine?
231
223
  not machine.nil?
232
224
  end
233
225
  def killable?
234
- not permanent? and (node? || client? || created?)
226
+ (not bogus?) && (not permanent?) && (node? || client? || created?)
235
227
  end
236
228
  def launchable?
237
- not bogus? and not created?
229
+ (not bogus?) && (not created?)
238
230
  end
239
231
  def node?
240
232
  not node.nil?
@@ -245,13 +237,13 @@ module Ironfan
245
237
  [true, :true, 'true'].include? server.selected_cloud.permanent
246
238
  end
247
239
  def running?
248
- machine? and machine.running?
240
+ machine? && machine.running?
249
241
  end
250
242
  def server?
251
243
  not server.nil?
252
244
  end
253
245
  def stopped?
254
- machine? and machine.stopped?
246
+ machine? && machine.stopped?
255
247
  end
256
248
 
257
249
  # @return [Boolean] true if machine is likely to be reachable by ssh
@@ -295,15 +287,15 @@ module Ironfan
295
287
 
296
288
  def validate
297
289
  computers = self
298
- values.each{|c| c.validate }
290
+ values.each{|c| c.validate }
299
291
  values.map {|c| c.providers.values}.flatten.uniq.each {|p| p.validate computers }
300
292
  end
301
293
 
302
294
  def group_action(verb)
303
295
  computers = self
304
- provider_keys = values.map {|c| c.chosen_providers({ :providers => :iaas })}.flatten.uniq
305
- providers = provider_keys.map { |pk| values.map { |c| c.providers[pk] } }.flatten.compact.uniq
306
- providers.each { |p| p.send(verb, computers) }
296
+ provider_keys = values.map{|c| c.chosen_providers({ :providers => :iaas })}.flatten.uniq
297
+ providers = provider_keys.map{|pk| values.map{|c| c.providers[pk] } }.flatten.compact.uniq
298
+ providers.each{|p| p.send(verb, computers) }
307
299
  end
308
300
 
309
301
  def prepare
@@ -318,19 +310,19 @@ module Ironfan
318
310
  # Manipulation
319
311
  #
320
312
  def kill(options={})
321
- Ironfan.parallel(values) {|c| c.kill(options) }
313
+ Ironfan.parallel(values){|cc| cc.kill(options) }
322
314
  end
323
315
  def launch
324
- Ironfan.parallel(values) {|c| c.launch }
316
+ Ironfan.parallel(values){|cc| cc.launch }
325
317
  end
326
318
  def save(options={})
327
- Ironfan.parallel(values) {|c| c.save(options) }
319
+ Ironfan.parallel(values){|cc| cc.save(options) }
328
320
  end
329
321
  def start
330
- Ironfan.parallel(values) {|c| c.start }
322
+ Ironfan.parallel(values){|cc| cc.start }
331
323
  end
332
324
  def stop
333
- Ironfan.parallel(values) {|c| c.stop }
325
+ Ironfan.parallel(values){|cc| cc.stop }
334
326
  end
335
327
 
336
328
  def environments
@@ -351,7 +343,7 @@ module Ironfan
351
343
  # Return the selection inside another Computers collection
352
344
  def select(&block)
353
345
  result = empty_copy
354
- values.select(&block).each{|m| result << m}
346
+ values.select(&block).each{|mach| result << mach}
355
347
  result
356
348
  end
357
349
 
@@ -363,16 +355,14 @@ module Ironfan
363
355
 
364
356
  # Find all selected computers, as well as any bogus computers from discovery
365
357
  def slice(facet_name=nil, slice_indexes=nil)
366
- return self if (facet_name.nil? and slice_indexes.nil?)
367
- result = empty_copy
358
+ return self if (facet_name.nil? && slice_indexes.nil?)
368
359
  slice_array = build_slice_array(slice_indexes)
369
- each do |m|
370
- result << m if (m.bogus? or ( # bogus computer or
371
- ( m.server.facet_name == facet_name ) and # facet match and
372
- ( slice_array.include? m.server.index or # index match or
373
- slice_indexes.nil? ) ) ) # no indexes specified
360
+ select do |mach|
361
+ mach.bogus? or (
362
+ # facet match, and index match (or no indexes specified)
363
+ (mach.server.facet_name == facet_name) &&
364
+ (slice_array.include?(mach.server.index) || slice_indexes.nil?))
374
365
  end
375
- result
376
366
  end
377
367
 
378
368
  def build_slice_array(slice_indexes)
@@ -31,11 +31,15 @@ module Ironfan
31
31
  end
32
32
 
33
33
  def display(computers,style)
34
- defined_data = computers.map {|m| m.to_display(style) }
34
+ defined_data = computers.map do |mach|
35
+ hsh = mach.to_display(style)
36
+ hsh.merge!(yield(mach)) if block_given?
37
+ hsh
38
+ end
35
39
  if defined_data.empty?
36
40
  ui.info "Nothing to report"
37
41
  else
38
- headings = defined_data.map{|r| r.keys}.flatten.uniq
42
+ headings = defined_data.map{|hsh| hsh.keys }.flatten.uniq
39
43
  Formatador.display_compact_table(defined_data, headings.to_a)
40
44
  end
41
45
  end
@@ -19,6 +19,7 @@ module Ironfan
19
19
  def self.multiple?() true; end
20
20
  def self.resource_type() :security_group; end
21
21
  def self.expected_ids(computer)
22
+ return unless computer.server
22
23
  ec2 = computer.server.cloud(:ec2)
23
24
  ec2.security_groups.keys.map { |name| group_name_with_vpc(name,ec2.vpc) }.uniq
24
25
  end
@@ -73,7 +74,7 @@ module Ironfan
73
74
  # First, deduce the list of all groups to which at least one instance belongs
74
75
  # We'll use this later to decide whether to create groups, or authorize access,
75
76
  # using a VPC security group or an EC2 security group.
76
- groups_that_should_exist = computers.map { |c| expected_ids(c) }.flatten.sort.uniq
77
+ groups_that_should_exist = computers.map{|comp| expected_ids(comp) }.flatten.compact.sort.uniq
77
78
  groups_to_create << groups_that_should_exist
78
79
 
79
80
  computers.select { |computer| Ec2.applicable computer }.each do |computer|
data/notes/Home.md CHANGED
@@ -44,6 +44,11 @@ Ironfan consists of the following toolset:
44
44
  * [ironfan issues](https://github.com/infochimps-labs/ironfan/issues): bugs, questions and feature requests for *any* part of the Ironfan toolset.
45
45
  * [ironfan gem docs](http://rdoc.info/gems/ironfan): rdoc docs for Ironfan
46
46
 
47
+
48
+ <a name="documentation"></a>
49
+ ### Documentation
50
+ * [EC2 Instance Pricing and Capacity Reference](https://github.com/infochimps-labs/ironfan/wiki/ec2-pricing_and_capacity) * [EC2 Pricing and Capacity Spreadsheet](https://github.com/infochimps-labs/ironfan/wiki/ec2-pricing_and_capacity.numbers) -- source data, and calculations for Hadoop tunables
51
+
47
52
  __________________________________________________________________________
48
53
  __________________________________________________________________________
49
54
  __________________________________________________________________________
@@ -1,25 +1,31 @@
1
1
  ## Compute Costs
2
2
 
3
3
 
4
- code $/mo $/day $/hr Mem/$ CPU/$ mem cpu cores cpcore storage disks bits ebs-opt IO
5
- t1.micro 15 0.48 .02 13 13 0.61 0.25 0.25 1 0 0 32 - Low
6
- m1.small 47 1.56 .065 26 15 1.7 1 1 1 160 1 32 - Moderate
7
- m1.medium 95 3.12 .13 15 15 3.75 2 2 1 410 1 32 - Moderate
8
- c1.medium 124 4.08 .165 10 30 1.7 5 2 2.5 350 1 32 - Moderate
9
- m1.large 190 6.24 .26 29 15 7.5 4 2 2 850 2 64 500 High
10
- m2.xlarge 329 10.80 .45 38 14 17.1 6.5 2 3.25 420 1 64 - Moderate
11
- m1.xlarge 380 12.48 .52 29 15 15 8 4 2 1690 4 64 1000 High
12
- m3.xlarge 424 13.92 .58 26 22 15 13 4 3.25 0 0 64 - Moderate
13
- c1.xlarge 482 15.84 .66 11 30 7 20 8 2.5 1690 4 64 - High
14
- m2.2xlarge 658 21.60 .90 38 14 34.2 13 4 3.25 850 2 64 - High
15
- m3.2xlarge 847 27.84 1.16 26 22 30 26 8 3.25 0 0 64 - High
16
- cc1.4xlarge 950 31.20 1.30 18 26 23 33.5 8 4.2 1690 4 64 - 10GB
17
- m2.4xlarge 1315 43.20 1.80 38 14 68.4 26 8 3.25 1690 2 64 1000 High
18
- cg1.4xlarge 1534 50.40 2.10 10 16 22 33.5 8 4.2 1690 4 64 - 10GB
19
- cc2.8xlarge 1753 57.60 2.40 25 37 60.5 88 16 5.5 3370 2 64 - 10GB
20
- hi1.4xlarge 2265 74.40 3.10 20 11 60.5 35 16 2.2 2048 ssd 2 64 - 10GB
21
- cr1.8xlarge 2557 84.00 3.50 70 25 244 88 16 5.5 240 ssd 2 64 - 10GB
22
- hs1.8xlarge 3361 110.40 4.60 25 8 117 35 16 2.2 49152 24 64 - 10GB
4
+ code $/mo $/day $/hr Mem/$ CPU/$ mem cpu cores cpcore storage disks ebs-opt IO
5
+ t1.micro 15 0.48 .02 31 13 .61 0.25 1 0.25 - 0 Lo
6
+ m1.small 44 1.44 .06 28 17 1.7 1 1 1 160 1 Med
7
+ m1.medium 88 2.88 .12 31 17 3.75 2 2 1 410 1 Med
8
+ c1.medium 106 3.48 .15 12 34 1.7 5 2 2.5 350 1 Med
9
+ m1.large 175 5.76 .24 31 17 7.5 4 2 2 850 2 Hi
10
+ m1.lg+ebs 194 6.36 .27 28 15 7.5 4 2 2 850 2 500 Hi+EBS
11
+ m2.xlarge 300 9.84 .41 42 16 17.1 6.5 2 3.25 420 1 Med
12
+ m1.xlarge 351 11.52 .48 31 17 15. 8 4 2 1690 4 Hi
13
+ m3.xlarge 365 12.00 .50 30 26 15. 13 4 3.25 - 0 Med
14
+ m1.xl+ebs 387 12.72 .53 28 15 15. 8 4 2 1690 4 1000 Hi+EBS
15
+ c1.xlarge 424 13.92 .58 12 34 7. 20 8 2.5 1690 4 Hi
16
+ m2.2xlarge 599 19.68 .82 42 16 34.2 13 4 3.25 850 2 Hi
17
+ m3.2xlarge 731 24.00 1.00 30 26 30. 26 8 3.25 - 0 Hi
18
+ cc1.4xlarge 950 31.20 1.30 18 26 23. 33.5 8 4.2 1690 4 10gb
19
+ m2.4xlarge 1198 39.36 1.64 42 16 68.4 26 8 3.25 1690 2 Hi
20
+ m2.4xl+ebs 1235 40.56 1.69 40 15 68.4 26 8 3.25 1690 2 1000 Hi+EBS
21
+ cg1.4xlarge 1534 50.40 2.10 10 16 22. 33.5 8 4.2 1690 4 10gb
22
+ cc2.8xlarge 1753 57.60 2.40 25 37 60.5 88 16 5.5 3370 2 10gb
23
+ hi1.4xlarge 2265 74.40 3.10 20 11 60.5 35.2 16 2.2 2048 ssd 2 10gb
24
+ cr1.8xlarge 2557 84.00 3.50 70 25 244. 88 16 5.5 240 ssd 2 10gb
25
+ hs1.8xlarge 3361 110.40 4.60 25 8 117. 35 16 2.2 49152 24 10gb
26
+
27
+ Prices are for standard (non-reserved) instances. EBS-optimized instances are listed on their own line.
28
+
23
29
 
24
30
  ## Storage Costs
25
31
 
Binary file
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.8.2
5
+ version: 4.8.3
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: 2013-02-21 00:00:00 Z
13
+ date: 2013-02-26 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -284,7 +284,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
284
284
  requirements:
285
285
  - - ">="
286
286
  - !ruby/object:Gem::Version
287
- hash: 1631771956177080084
287
+ hash: 4061434417282222505
288
288
  segments:
289
289
  - 0
290
290
  version: "0"