Class: Spiceweasel::Clusters
- Inherits:
-
Object
- Object
- Spiceweasel::Clusters
- Defined in:
- lib/spiceweasel/clusters.rb
Instance Attribute Summary collapse
-
#create ⇒ Object
readonly
Returns the value of attribute create.
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
Instance Method Summary collapse
-
#initialize(clusters, cookbooks, environments, roles) ⇒ Clusters
constructor
A new instance of Clusters.
Constructor Details
#initialize(clusters, cookbooks, environments, roles) ⇒ Clusters
Returns a new instance of Clusters.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/spiceweasel/clusters.rb', line 24 def initialize(clusters, cookbooks, environments, roles) @create = Array.new @delete = Array.new if clusters Spiceweasel::Log.debug("clusters: #{clusters}") clusters.each do |cluster| cluster_name = cluster.keys.first Spiceweasel::Log.debug("cluster: '#{cluster_name}' '#{cluster[cluster_name]}'") # add a tag to the Nodes cluster[cluster_name].each do |node| node_name = node.keys.first run_list = node[node_name]['run_list'] || '' = node[node_name]['options'] || '' # cluster tag is the cluster name + runlist once tags are working for every plugin # until then, we're going to override the Environment if =~ /-E/ #delete any Environment env = .split('-E')[1].split[0] edel = "-E#{env}" [edel] = "" if .include?(edel) edel = "-E #{env}" [edel] = "" if .include?(edel) Spiceweasel::Log.warn("deleting specified Environment '#{env}' from cluster: '#{cluster_name}'") end #push the Environment back on the options node[node_name]['options'] = + " -E #{cluster_name}" end # let's reuse the Nodes logic nodes = Spiceweasel::Nodes.new(cluster[cluster_name], cookbooks, environments, roles) @create.concat(nodes.create) @delete.concat(nodes.delete) end end end |
Instance Attribute Details
#create ⇒ Object (readonly)
Returns the value of attribute create.
22 23 24 |
# File 'lib/spiceweasel/clusters.rb', line 22 def create @create end |
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
22 23 24 |
# File 'lib/spiceweasel/clusters.rb', line 22 def delete @delete end |