alpha_omega 0.0.75 → 0.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ module AlphaOmega
26
26
  node.deep_merge!(pods_config[env_pod])
27
27
 
28
28
  # enrich with opsdb
29
- node.deep_merge!(opsdb[env_pod][node_name])
29
+ node.deep_merge!(opsdb[env_pod][node_name]) if opsdb[env_pod].key? node_name
30
30
 
31
31
  node["run_list"] = node["run_list"].clone # TODO without a clone, node.run_list also updates pods_config.env_pod.run_list
32
32
 
@@ -199,7 +199,7 @@ module AlphaOmega
199
199
 
200
200
  # opsdb config
201
201
  opsdb = Dir["#{node_home}/config/pod/*.yaml"].inject({}) do |acc, fname|
202
- env_pod = File.basename fname, ".yaml"
202
+ env_pod = File.basename(File.basename(fname, ".yaml"), ".json")
203
203
  acc[env_pod] = YAML.load(File.read(fname))
204
204
  acc
205
205
  end
@@ -208,18 +208,18 @@ module AlphaOmega
208
208
 
209
209
  this_pod = File.read("/etc/podname").strip
210
210
  pods["default"] = {
211
- "nodes_spec" => "#{node_home}/pods/#{this_pod}/*.yaml",
211
+ "nodes_specs" => [ "#{node_home}/pods/#{this_pod}/*.yaml", "#{node_home}/pods/#{this_pod}/*.json" ],
212
212
  "node_suffix" => ""
213
213
  }
214
214
  yield config, "default", pods["default"], pods_config, opsdb, this_pod # TODO get rid of default and use this_pod
215
215
 
216
216
  this_host = Socket.gethostname.chomp.split(".")[0]
217
- n = YAML.load(File.read("#{node_home}/pods/#{this_pod}/#{this_host}.yaml"))
217
+ n = File.exists?("#{node_home}/pods/#{this_pod}/#{this_host}.yaml") ? YAML.load(File.read("#{node_home}/pods/#{this_pod}/#{this_host}.yaml")) : JSON.load(File.read("#{node_home}/pods/#{this_pod}/#{this_host}.json"))
218
218
  this_node = AlphaOmega.node_defaults(n, pods_config, opsdb, this_pod, this_pod, this_host)
219
219
 
220
220
  (this_node["pods"] || []).each do |pod_name|
221
221
  pods[pod_name] = {
222
- "nodes_spec" => "#{node_home}/pods/#{pod_name}/*.yaml",
222
+ "nodes_specs" => [ "#{node_home}/pods/#{pod_name}/*.yaml", "#{node_home}/pods/#{pod_name}/*.json" ],
223
223
  "node_suffix" => ".#{pod_name}"
224
224
  }
225
225
  yield config, pod_name, pods[pod_name], pods_config, opsdb, this_pod
@@ -230,14 +230,16 @@ module AlphaOmega
230
230
 
231
231
  def self.what_hosts (pod)
232
232
  # load all the nodes and define cap tasks
233
- Dir[pod["nodes_spec"]].inject({}) do |acc, fname|
234
- node_name = File.basename(fname, ".yaml")
233
+ pod["nodes_specs"].inject({}) do |hosts, spec|
234
+ Dir[spec].inject(hosts) do |acc, fname|
235
+ node_name = File.basename(File.basename(fname, ".yaml"), ".json")
235
236
 
236
- node = YAML.load(IO.read(fname))
237
- node["node_name"] = node_name
237
+ node = YAML.load(IO.read(fname))
238
+ node["node_name"] = node_name
238
239
 
239
- acc[node_name] = yield node_name, "#{node_name}#{pod["node_suffix"]}", node unless node["virtual"]
240
- acc
240
+ acc[node_name] = yield node_name, "#{node_name}#{pod["node_suffix"]}", node unless node["virtual"]
241
+ acc
242
+ end
241
243
  end
242
244
  end
243
245
 
@@ -1,3 +1,3 @@
1
1
  module AlphaOmega
2
- Version = "0.0.75"
2
+ Version = "0.0.76"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_omega
3
3
  version: !ruby/object:Gem::Version
4
- hash: 137
4
+ hash: 135
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 75
10
- version: 0.0.75
9
+ - 76
10
+ version: 0.0.76
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem
@@ -131,29 +131,29 @@ files:
131
131
  - LICENSE
132
132
  - README.mkd
133
133
  - Procfile.rb
134
+ - libexec/patch
135
+ - libexec/shell
136
+ - libexec/compare
137
+ - libexec/rollback
134
138
  - libexec/dna
135
139
  - libexec/hosts
136
- - libexec/rollback
137
- - libexec/shell
138
140
  - libexec/check
139
- - libexec/compare
140
141
  - libexec/deploy
141
142
  - libexec/stage
142
- - libexec/patch
143
143
  - lib/alpha_omega/version.rb
144
+ - lib/alpha_omega/utils.rb
145
+ - lib/alpha_omega/deploy.rb
144
146
  - lib/alpha_omega/deploy/strategy.rb
147
+ - lib/alpha_omega/deploy/strategy/checkout.rb
148
+ - lib/alpha_omega/deploy/strategy/remote.rb
149
+ - lib/alpha_omega/deploy/strategy/base.rb
150
+ - lib/alpha_omega/deploy/templates/maintenance.rhtml
145
151
  - lib/alpha_omega/deploy/remote_dependency.rb
146
152
  - lib/alpha_omega/deploy/scm.rb
147
153
  - lib/alpha_omega/deploy/dependencies.rb
148
- - lib/alpha_omega/deploy/strategy/base.rb
149
- - lib/alpha_omega/deploy/strategy/remote.rb
150
- - lib/alpha_omega/deploy/strategy/checkout.rb
151
154
  - lib/alpha_omega/deploy/local_dependency.rb
152
- - lib/alpha_omega/deploy/templates/maintenance.rhtml
153
155
  - lib/alpha_omega/deploy/scm/git.rb
154
156
  - lib/alpha_omega/deploy/scm/base.rb
155
- - lib/alpha_omega/deploy.rb
156
- - lib/alpha_omega/utils.rb
157
157
  - bin/alpha_omega
158
158
  has_rdoc: true
159
159
  homepage: https://github.com/HeSYINUvSBZfxqA/alpha_omega