ironfan 4.0.2 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -45,4 +45,4 @@ Ironfan consists of the following Toolset:
45
45
 
46
46
  ### Getting Help
47
47
  * Feel free to contact us at info@infochimps.com or 855-DATA-FUN
48
- * Also, you invited to a [private consultation](http://www.infochimps.com/free-big-data-consultation?utm_source=git&utm_medium=referral&utm_campaign=consult) with Infochimps founders on your big data project.
48
+ * Also, you're invited to a [private consultation](http://www.infochimps.com/free-big-data-consultation?utm_source=git&utm_medium=referral&utm_campaign=consult) with Infochimps founders on your big data project.
data/TODO.md CHANGED
@@ -2,57 +2,19 @@
2
2
 
3
3
  * We should use the `Fog::Compute::AWS::FLAVORS` constant that [fog defines](http://rubydoc.info/github/fog/fog/master/Fog/Compute/AWS) in the cloud code (instead of the one we put there)
4
4
 
5
- * All over the place there is the following construct (absolutely necessary, absolutely horrid):
6
-
7
- foo = Mash.new().merge(node[:system]).merge(node[:system][:component])
8
-
9
- You might look at this and think "gee I know a much simpler way to do that". That simpler way does not work; this way does.
10
-
11
- I propose adding a 'smush' method to `silverware/libraries/cookbook_utils`:
12
-
13
- ```ruby
14
- module Ironfan::CookbookUtils
15
- module_function
16
-
17
- # Merge the given objects (node attributes, hashes, or anything
18
- # else with `#to_hash`) into a combined `Mash` object. Objects
19
- # given later in the list 'win' over objects given earlier.
20
- #
21
- # @examples
22
- # template_vars = Ironfan::CookbookUtils.smush( node[:flume], node[:flume][:agent], :zookeeper_port => node[:zookeeper][:port] )
23
- #
24
- # @param [Array[#to_hash]] smushables -- any number of things that respond to `#to_hash`
25
- #
26
- def smush(*smushables)
27
- result = Mash.new
28
- smushables.compact.each do |smushable|
29
- result.merge! smushable.to_hash
30
- end
31
- result
32
- end
33
-
34
- end
35
-
36
- (obviously the hard part is not writing the method, it's applying it to all the cookbooks.)
37
-
38
5
 
39
6
 
40
7
  ### Knife commands
41
-
42
- * reify notion of 'homebase'; cluster commands work off it
43
8
  * move away from referring to Chef::Config everywhere;
44
9
 
45
10
 
46
-
47
-
48
-
49
11
  # Old Issues Triage
50
12
  From https://github.com/infochimps-labs/ironfan/issues/102 with love. Deleted ownership, and everything that was done or has its own issue.
51
13
 
52
14
  ## Must Do
53
15
  * merge volumes into silverware. merge ebs_volumes into ec2 cookbook
54
16
  * Basic CI testing of cookbooks
55
- * RSpecs for silverback (lib and knife tools)
17
+ * RSpecs for ironfan (lib and knife tools)
56
18
  * RSpecs for silverware are mostly in place -- ensure they are.
57
19
  * push cookbooks to community.opscode.com
58
20
  * refine and explain updated git workflow
@@ -60,18 +22,12 @@ From https://github.com/infochimps-labs/ironfan/issues/102 with love. Deleted ow
60
22
  ## Docco
61
23
  Use the [opscode EC2 fast start](http://wiki.opscode.com/display/chef/EC2+Bootstrap+Fast+Start+Guide) as a guide -- our getting started should start at the same place, and cover the same detail as the EC2 bootstrap guide.
62
24
 
63
- * Clear description of metadiscovery
25
+ * Clear description of discovery
64
26
  * make sure README files in cookbooks aren’t wildly inaccurate
65
- * Carry out setup directions, ensure they work:
66
- - cluster_chef if you’re using our homebase
67
- - cluster_chef if you’re using opscode’s homebase
68
- * local vagrant environment
69
27
  * hadoop cluster bootstrapping
70
28
 
71
29
  ## Piddly Shit
72
-
73
30
  * standardize the `zabbix` cookbook (no more /opt, etc -- more in the TODO)
74
- * volumes don't deep merge -- eg you have to mount_ephemerals in the facet if you modify htem
75
31
  * kill_old_service should disable services (may be leaving /etc/rc.d cruft).
76
32
  * kill old service doesn't go the first time. why?
77
33
  * chef client/server cookbook: set chef user UID / GID; client can set log directory
@@ -81,8 +37,6 @@ Use the [opscode EC2 fast start](http://wiki.opscode.com/display/chef/EC2+Bootst
81
37
  * style-guide alignment (prefix_root becomes prefix)
82
38
 
83
39
  ## Really Want
84
-
85
- * unify the hashlike underpinning to be same across silverware & cluster_chef. Make sure we love (or accept) all the differences between it and Gorrillib’s, and between it and Chef’s.
86
40
  * Keys are transmitted in databags, using a helper, and not in node attributes
87
41
  * easy to create a dummy node (load balancer, external resource, etc)
88
42
  * components can have arbitrary attributes (kinda. they take an `:info` param, behavior which may change later)
@@ -138,11 +92,9 @@ Use the [opscode EC2 fast start](http://wiki.opscode.com/display/chef/EC2+Bootst
138
92
  * move cluster discovery to cloud class.
139
93
  * Server#normalize! doesn’t imprint object (ie. server attributes poke through to the facet & cluster, rather than being *set* on the object)
140
94
  * The fact you can only see one cluster at a time is stupid.
141
- * security group pairing is sucky.
142
95
  * ubuntu home drive bullshit
143
96
  * Finer-grained security group control (eg nfs server only opens a couple ports, not all)
144
97
  * nfs recipe uses discovery right (thus allowing more than one NFS share to exist in the universe)
145
- * roles UGGGHHHHAERWSDFKHSBLAH
146
98
 
147
99
  ## Ponies!
148
100
  * sync cookbooks up/down to `infochimps-cookbooks/` 
@@ -152,4 +104,3 @@ Use the [opscode EC2 fast start](http://wiki.opscode.com/display/chef/EC2+Bootst
152
104
  * spot pricing
153
105
  * rackspace compatibility
154
106
  * cookbook munger reads comments in attributes file to populate metadata.rb
155
- * `gem install ironfan; ironfan install` checks everything out
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.2
1
+ 4.0.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.0.2"
8
+ s.version = "4.0.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 = "2012-09-07"
12
+ s.date = "2012-09-12"
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 = [
@@ -34,12 +34,6 @@ module Ironfan
34
34
  #
35
35
  def correlate
36
36
  chosen_resources.each do |res|
37
- unless res.respond_to? :expected_ids
38
- Chef::Log.warn("FIXME: Using correlate! instead of on_correlate in #{res}")
39
- res.correlate! self
40
- return
41
- end
42
-
43
37
  res.expected_ids(self).each do |id|
44
38
  next unless res.recall? id
45
39
 
@@ -55,9 +49,6 @@ module Ironfan
55
49
  end
56
50
  end
57
51
 
58
- def correlate_with(res)
59
- end
60
-
61
52
  def validate
62
53
  computer = self
63
54
  Ironfan.delegate_to(chosen_resources) { validate_computer! computer }
@@ -8,11 +8,11 @@ module Ironfan
8
8
 
9
9
  field :name, String
10
10
 
11
- def volume=(value)
12
- super
13
- return unless value
14
- # inscribe the cluster DSL values into chef attributes
15
- volume.attributes.each_pair {|k,v| node[k.to_s] = v }
11
+ # A drive should include volume attributes in any node references
12
+ def node()
13
+ result = super
14
+ result.merge! volume.attributes unless volume.nil?
15
+ result
16
16
  end
17
17
 
18
18
  end
@@ -67,7 +67,7 @@ module Ironfan
67
67
  normal[:facet_name] = server.facet_name
68
68
  normal[:permanent] = computer.permanent?
69
69
  normal[:volumes] = {}
70
- computer.drives.each {|v| normal[:volumes][v.name] = v.node}
70
+ computer.drives.each {|d| normal[:volumes][d.name] = d.node}
71
71
  end
72
72
 
73
73
  def announce_state state
@@ -16,14 +16,14 @@ module Ironfan
16
16
  :to => :adaptee
17
17
  field :dsl_volume, Ironfan::Dsl::Volume
18
18
 
19
- def self.shared?() false; end
19
+ def self.shared?() true; end
20
20
  def self.multiple?() true; end
21
21
  def self.resource_type() :ebs_volume; end
22
22
  def self.expected_ids(computer)
23
23
  computer.server.volumes.values.map do |volume|
24
24
  saved = computer.node[:volumes][volume.name][:volume_id] rescue nil
25
25
  ebs_name = "#{computer.server.fullname}-#{volume.name}"
26
- [ volume.volume_id, saved, ebs_name]
26
+ [ volume.volume_id, saved, ebs_name ]
27
27
  end.flatten.compact
28
28
  end
29
29
 
@@ -31,6 +31,11 @@ module Ironfan
31
31
  tags["Name"] || tags["name"] || id
32
32
  end
33
33
 
34
+ def drivename
35
+ return id unless tags.key? "Name"
36
+ tags["Name"].split('-').pop
37
+ end
38
+
34
39
  def ephemeral_device?
35
40
  false
36
41
  end
@@ -54,59 +59,22 @@ module Ironfan
54
59
  end
55
60
 
56
61
  def on_correlate(computer)
57
- Chef::Log.warn("ebs_volume::on_correlate is incomplete")
62
+ drive = computer.drive(drivename)
63
+ drive.disk = self
64
+ drive.node = computer.node[:volumes][drivename].to_hash rescue {}
65
+ drive
58
66
  end
59
67
 
60
- # def self.correlate!(computer)
61
- # Chef::Log.warn("CODE SMELL: overly large method: #{caller}")
62
- # return unless computer.server?
63
- # computer.server.volumes.each do |volume|
64
- # unless volume.attachable.to_s == 'ebs'
65
- # Chef::Log.debug("Ignoring non-EBS volume = #{volume}")
66
- # next
67
- # end
68
- #
69
- # drive = computer.drive(volume.name)
70
- # drive.node = computer.node[:volumes][volume.name].to_hash rescue {}
71
- # if drive.node.has_key? :volume_id
72
- # node_volume_id = drive.node[:volume_id]
73
- # end
74
- # ebs_name = "#{computer.server.fullname}-#{volume.name}"
75
- #
76
- # volume_id = volume.volume_id
77
- # volume_id ||= node_volume_id
78
- #
79
- # # Volumes may match against name derived from the cluster definition,
80
- # # or volume_id from the cluster definition or node
81
- # case
82
- # when (recall? ebs_name)
83
- # ebs = recall ebs_name
84
- # when (volume_id and recall? volume_id)
85
- # ebs = recall volume_id
86
- # else
87
- # log_message = "Volume not found: name = #{ebs_name}"
88
- # log_message += ", volume_id = #{volume_id}"
89
- # Chef::Log.debug(log_message)
90
- # next
91
- # end
92
- #
93
- # # Make sure all the known volume_ids match
94
- # [ ebs.id, volume.volume_id, node_volume_id ].compact.each do |id|
95
- # id == volume_id or ebs.bogus << :volume_id_mismatch
96
- # end if volume_id
97
- #
98
- # computer.bogus += ebs.bogus
99
- # ebs.owner = computer.object_id
100
- # drive.volume = volume
101
- # drive.disk = ebs
102
- # end
103
- # end
104
68
  def self.validate_computer!(computer)
105
- Chef::Log.warn("ebs_volume::validate_computer! is incomplete")
106
- # # Make sure all the known volume_ids match
107
- # [ ebs.id, volume.volume_id, node_volume_id ].compact.each do |id|
108
- # id == volume_id or ebs.bogus << :volume_id_mismatch
109
- # end if volume_id
69
+ computer.drives.each do |drive|
70
+ next unless drive.disk.class == EbsVolume
71
+ [ (drive.node['volume_id'] rescue nil),
72
+ (drive.volume.volume_id rescue nil)
73
+ ].compact.each do |id|
74
+ Chef::Log.debug "checking #{id} against ebs_volume id #{drive.disk.id}"
75
+ id == drive.disk.id or drive.disk.bogus << :volume_id_mismatch
76
+ end
77
+ end
110
78
  end
111
79
 
112
80
  #
@@ -126,8 +94,6 @@ module Ironfan
126
94
  ebs.server = computer.machine.adaptee
127
95
  end
128
96
  end
129
- # Record the volume information in chef
130
- drive.node['volume_id'] = ebs.id
131
97
  end
132
98
  end
133
99
  end
@@ -165,8 +165,11 @@ module Ironfan
165
165
  drive.disk = ebs_vol
166
166
 
167
167
  vol_name = "#{computer.name}-#{drive.volume.name}"
168
+ tags['server'] = computer.name
168
169
  tags['name'] = vol_name
169
170
  tags['Name'] = vol_name
171
+ tags['mount_point'] = drive.volume.mount_point
172
+ tags['device'] = drive.volume.device
170
173
  Ec2.ensure_tags(tags,ebs_vol)
171
174
  end
172
175
  end
@@ -222,8 +225,7 @@ module Ironfan
222
225
  hsh['Ebs.SnapshotId'] = volume.snapshot_id if volume.snapshot_id.present?
223
226
  hsh['Ebs.VolumeSize'] = volume.size.to_s if volume.size.present?
224
227
  hsh['Ebs.DeleteOnTermination'] = (not volume.keep).to_s
225
- else
226
- next
228
+ else next
227
229
  end
228
230
  hsh
229
231
  end.compact
@@ -54,7 +54,6 @@ module Ironfan
54
54
  # Discovery
55
55
  #
56
56
  def self.load!(*p) Ironfan.noop(self,__method__,*p); end
57
- def self.correlate!(*p) Ironfan.noop(self,__method__,*p); end
58
57
  def self.validate_computer!(*p) Ironfan.noop(self,__method__,*p); end
59
58
  def self.validate_resources!(*p) Ironfan.noop(self,__method__,*p); end
60
59
 
@@ -70,7 +69,7 @@ module Ironfan
70
69
  #
71
70
  # Utilities
72
71
  #
73
- [:shared?, :multiple?, :load!,:correlate!,:validate_computer!,
72
+ [:shared?, :multiple?, :load!,:validate_computer!,
74
73
  :validate_resources!,:create!,:save!,:destroy!].each do |method_name|
75
74
  define_method(method_name) {|*p| self.class.send(method_name,*p) }
76
75
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.0.2
5
+ version: 4.0.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: 2012-09-07 00:00:00 Z
13
+ date: 2012-09-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  requirements:
233
233
  - - ">="
234
234
  - !ruby/object:Gem::Version
235
- hash: 318287528418950841
235
+ hash: 3321055109104960194
236
236
  segments:
237
237
  - 0
238
238
  version: "0"