ironfan 4.11.5 → 4.12.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,6 @@
1
+ # v4.12.0
2
+ * Added realms (supra-cluster scoping): see https://github.com/infochimps-labs/ironfan/pull/308 for details
3
+
1
4
  # v4.11.5
2
5
  * Update ELB creation code to reflect new SSLNegotiationPolicyType behaviors (thanks @nickmarden)
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.11.5
1
+ 4.12.0
data/ironfan.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ironfan"
8
- s.version = "4.11.5"
8
+ s.version = "4.12.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"]
@@ -71,6 +71,7 @@ Gem::Specification.new do |s|
71
71
  "lib/ironfan/dsl/ec2.rb",
72
72
  "lib/ironfan/dsl/facet.rb",
73
73
  "lib/ironfan/dsl/rds.rb",
74
+ "lib/ironfan/dsl/realm.rb",
74
75
  "lib/ironfan/dsl/role.rb",
75
76
  "lib/ironfan/dsl/server.rb",
76
77
  "lib/ironfan/dsl/virtualbox.rb",
@@ -20,4 +20,4 @@ module Ironfan
20
20
  end
21
21
 
22
22
  end
23
- end
23
+ end
@@ -0,0 +1,22 @@
1
+ module Ironfan
2
+ class Dsl
3
+
4
+ class Realm < Ironfan::Dsl::Compute
5
+ collection :clusters, Ironfan::Dsl::Cluster, :resolver => :deep_resolve
6
+
7
+ def initialize(attrs={},&block)
8
+ super
9
+ end
10
+
11
+ def cluster(label, attrs={},&blk)
12
+ new_name = [realm_name, label].join '_'
13
+ cluster = Ironfan::Dsl::Cluster.new(name: new_name)
14
+ cluster.receive!(attrs, &blk)
15
+ super(new_name, cluster)
16
+ end
17
+
18
+ def realm_name() name; end
19
+ end
20
+
21
+ end
22
+ end
@@ -13,6 +13,7 @@ require 'ironfan/dsl/compute'
13
13
  require 'ironfan/dsl/server'
14
14
  require 'ironfan/dsl/facet'
15
15
  require 'ironfan/dsl/cluster'
16
+ require 'ironfan/dsl/realm'
16
17
 
17
18
  require 'ironfan/dsl/role'
18
19
  require 'ironfan/dsl/volume'
data/lib/ironfan.rb CHANGED
@@ -2,6 +2,7 @@ require 'ironfan/requirements'
2
2
 
3
3
  module Ironfan
4
4
  @@clusters ||= Hash.new
5
+ @@realms ||= Hash.new
5
6
 
6
7
  # path to search for cluster definition files
7
8
  def self.cluster_path
@@ -18,6 +19,12 @@ module Ironfan
18
19
  @@clusters
19
20
  end
20
21
 
22
+ #
23
+ # Delegates
24
+ def self.realms
25
+ @@realms
26
+ end
27
+
21
28
  def self.ui=(ui) @ui = ui ; end
22
29
  def self.ui() @ui ; end
23
30
 
@@ -72,6 +79,18 @@ module Ironfan
72
79
  end
73
80
  end
74
81
 
82
+ def self.realm(name, attrs={}, &block)
83
+ name = name.to_sym
84
+ if @@realms[name] and attrs.empty? and not block_given?
85
+ return @@realms[name]
86
+ else
87
+ rlm = Ironfan::Dsl::Realm.new(:name => name)
88
+ rlm.receive!(attrs, &block)
89
+ rlm.clusters.keys.each{|k| @@clusters[k.to_sym] = rlm.clusters[k].resolve}
90
+ @@realms[name] = rlm
91
+ end
92
+ end
93
+
75
94
  #
76
95
  # Return cluster if it's defined. Otherwise, search Ironfan.cluster_path
77
96
  # for an eponymous file, load it, and return the cluster it defines.
@@ -85,12 +104,14 @@ module Ironfan
85
104
  raise ArgumentError, "Please supply a cluster name" if name.to_s.empty?
86
105
  return @@clusters[name] if @@clusters[name]
87
106
 
88
- cluster_file = cluster_filenames[name] or raise("Couldn't find a definition for #{name} in cluster_path: #{cluster_path.inspect}")
89
-
90
- Chef::Log.info("Loading cluster #{cluster_file}")
107
+ cluster_path.each do |cp_dir|
108
+ Dir[ File.join(cp_dir, '*.rb') ].each do |filename|
109
+ Chef::Log.info("Loading cluster file #{filename}")
110
+ require filename
111
+ end
112
+ end
91
113
 
92
- require cluster_file
93
- unless @@clusters[name] then die("#{cluster_file} was supposed to have the definition for the #{name} cluster, but didn't") end
114
+ unless @@clusters[name] then die("Couldn't find a cluster definition for #{name} in #{cluster_path}") end
94
115
 
95
116
  @@clusters[name]
96
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.5
4
+ version: 4.12.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -282,6 +282,7 @@ files:
282
282
  - lib/ironfan/dsl/ec2.rb
283
283
  - lib/ironfan/dsl/facet.rb
284
284
  - lib/ironfan/dsl/rds.rb
285
+ - lib/ironfan/dsl/realm.rb
285
286
  - lib/ironfan/dsl/role.rb
286
287
  - lib/ironfan/dsl/server.rb
287
288
  - lib/ironfan/dsl/virtualbox.rb
@@ -381,7 +382,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
381
382
  version: '0'
382
383
  segments:
383
384
  - 0
384
- hash: -2976122810145852585
385
+ hash: -1961603152383725034
385
386
  required_rubygems_version: !ruby/object:Gem::Requirement
386
387
  none: false
387
388
  requirements: