ironfan 4.1.1 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.1
1
+ 4.2.0
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.1.1"
8
+ s.version = "4.2.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-09-27"
12
+ s.date = "2012-09-29"
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 = [
@@ -56,8 +56,12 @@ class Chef
56
56
  protected
57
57
 
58
58
  def dump_computer(computer)
59
+ header = "Computer #{computer.name} (#{computer.class})"
59
60
  with_verbosity 1 do
60
- dump("Computer #{computer.name} (#{computer.class})", computer.to_wire)
61
+ Chef::Log.info(header)
62
+ end
63
+ with_verbosity 2 do
64
+ dump(header, computer.to_wire)
61
65
  end
62
66
  end
63
67
 
@@ -16,7 +16,7 @@ module Ironfan
16
16
  computers = Computers.new(:cluster => cluster.resolve)
17
17
  #
18
18
  providers = computers.map{|c| c.providers.values }.flatten.uniq
19
- providers.each do |provider|
19
+ Ironfan.parallel(providers) do |provider|
20
20
  Ironfan.step cluster.name, "Loading #{provider.handle}", :cyan
21
21
  provider.load cluster
22
22
  end
@@ -45,9 +45,8 @@ module Ironfan
45
45
  # Discovery
46
46
  #
47
47
  def self.load!(cluster=nil)
48
- Ironfan.substep(cluster.name, "chef clients")
49
- nameq = "name:#{cluster.name}-* OR clientname:#{cluster.name}-*"
50
- ChefServer.search(:client, nameq) do |raw|
48
+ query = cluster && "name:#{cluster.name}-* OR clientname:#{cluster.name}-*"
49
+ ChefServer.search(:client, query) do |raw|
51
50
  next unless raw.present?
52
51
  client = register(raw)
53
52
  Chef::Log.debug("Loaded #{client}")
@@ -88,8 +88,8 @@ module Ironfan
88
88
  # Discovery
89
89
  #
90
90
  def self.load!(cluster=nil)
91
- Ironfan.substep(cluster.name, "nodes")
92
- ChefServer.search(:node,"name:#{cluster.name}-*") do |raw|
91
+ query = cluster && "name:#{cluster.name}-*"
92
+ ChefServer.search(:node, query) do |raw|
93
93
  next unless raw.present?
94
94
  node = register(raw)
95
95
  Chef::Log.debug("Loaded #{node}")
@@ -46,9 +46,9 @@ module Ironfan
46
46
  #
47
47
  # Discovery
48
48
  #
49
- def self.load!(cluster)
50
- Ironfan.substep(cluster.name, "roles")
51
- ChefServer.search(:role,"name:#{cluster.name}_*") do |raw|
49
+ def self.load!(cluster=nil)
50
+ query = cluster && "name:#{cluster.name}-*"
51
+ ChefServer.search(:role,query) do |raw|
52
52
  next unless raw.present?
53
53
  role = register(raw)
54
54
  Chef::Log.debug("Loaded #{role}")
@@ -49,7 +49,6 @@ module Ironfan
49
49
  # Discovery
50
50
  #
51
51
  def self.load!(cluster=nil)
52
- Ironfan.substep(cluster.name, "volumes")
53
52
  Ec2.connection.volumes.each do |vol|
54
53
  next if vol.blank?
55
54
  ebs = EbsVolume.new(:adaptee => vol)
@@ -33,7 +33,6 @@ module Ironfan
33
33
  # Discovery
34
34
  #
35
35
  def self.load!(cluster=nil)
36
- Ironfan.substep(cluster && cluster.name, "keypairs")
37
36
  Ec2.connection.key_pairs.each do |keypair|
38
37
  register keypair unless keypair.blank?
39
38
  Chef::Log.debug("Loaded <%-15s %s>" % [handle, keypair.name])
@@ -102,7 +102,6 @@ module Ironfan
102
102
  # Discovery
103
103
  #
104
104
  def self.load!(cluster=nil)
105
- Ironfan.substep(cluster.name, "machines")
106
105
  Ec2.connection.servers.each do |fs|
107
106
  machine = new(:adaptee => fs)
108
107
  if recall? machine.name
@@ -15,8 +15,7 @@ module Ironfan
15
15
  "<%-15s %-12s %-12s>" % [ self.class.handle, '', name ]
16
16
  end
17
17
 
18
- def self.load!(cluster)
19
- Ironfan.substep(cluster.name, "placement groups")
18
+ def self.load!(cluster=nil)
20
19
  result = Ec2.connection.describe_placement_groups
21
20
  result.body["placementGroupSet"].each do |group|
22
21
  register group unless group.blank?
@@ -24,8 +24,6 @@ module Ironfan
24
24
  # Discovery
25
25
  #
26
26
  def self.load!(cluster=nil)
27
- Ironfan.substep(cluster.name, "security groups")
28
-
29
27
  Ec2.connection.security_groups.each do |raw|
30
28
  next if raw.blank?
31
29
  sg = SecurityGroup.new(:adaptee => raw)
@@ -25,7 +25,12 @@ module Ironfan
25
25
  # Discovery
26
26
  #
27
27
  def self.load(cluster)
28
- resources.each {|r| r.load! cluster }
28
+ Ironfan.parallel (resources) do |r|
29
+ type = r.resource_type.to_s
30
+ Ironfan.substep(cluster.name, "loading #{type}s")
31
+ r.load! cluster
32
+ Ironfan.substep(cluster.name, "loaded #{type}s")
33
+ end
29
34
  end
30
35
 
31
36
  def self.validate(computers)
@@ -3,21 +3,23 @@ require 'spec_helper'
3
3
  require 'ironfan'
4
4
 
5
5
  describe Ironfan::Dsl::Cluster do
6
- describe 'run lists' do
7
- subject do
8
- Ironfan.cluster 'foo' do
9
- environment :dev
10
-
11
- role :systemwide
12
-
13
- facet :bar do
14
- instances 1
15
- role :nfs_client, :first
16
- end
17
- end
6
+ subject do
7
+ Ironfan.cluster 'foo' do
8
+ environment :dev
9
+
10
+ role :generic
11
+
12
+ role :is_last, :last
13
+ role :is_first, :first
18
14
  end
19
-
20
- its(:environment) { should eql :dev }
21
- its(:run_list) { should eql ["role[systemwide]"] }
22
15
  end
16
+
17
+ its(:environment) { should eql :dev }
18
+
19
+ its(:run_list) { should eql [
20
+ "role[is_first]",
21
+ "role[generic]",
22
+ "role[is_last]"
23
+ ]
24
+ }
23
25
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.1.1
5
+ version: 4.2.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-09-27 00:00:00 Z
13
+ date: 2012-09-29 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -229,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
229
  requirements:
230
230
  - - ">="
231
231
  - !ruby/object:Gem::Version
232
- hash: 481284130132022925
232
+ hash: 2633727153528237962
233
233
  segments:
234
234
  - 0
235
235
  version: "0"