alpha_omega 0.0.76 → 0.0.77

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.
@@ -63,7 +63,7 @@ module AlphaOmega
63
63
  end
64
64
 
65
65
  def self.default_pods_tasks
66
- Proc.new do |config, pod_name, pod, mix_pods, pods_config, opsdb, this_pod|
66
+ Proc.new do |config, pod_name, pod, mix_pods, pods_config, opsdb, this_pod, &node_filter|
67
67
  [ "", ".echo", ".yaml" ].each do |tsuffix|
68
68
  # world task accumulates all.* after tasks
69
69
  config.task "world#{tsuffix}" do
@@ -79,25 +79,30 @@ module AlphaOmega
79
79
  AlphaOmega.what_hosts pod do |task_name, remote_name, node|
80
80
  n = AlphaOmega.node_defaults(node, pods_config, opsdb, pod_name, this_pod, remote_name)
81
81
 
82
- config.task "#{task_name}.#{pod_name}" do
83
- role :app, remote_name
84
- end
85
-
86
- config.task "#{task_name}.#{pod_name}.echo" do
87
- puts "#{AlphaOmega.magic_prefix} #{remote_name}"
88
- end
89
-
90
- config.task "#{task_name}.#{pod_name}.yaml" do
91
- StringIO.new({ remote_name => n }.to_yaml).lines.each {|l| puts "#{AlphaOmega.magic_prefix} #{l}" }
92
- end
93
-
94
- [ "", ".echo", ".yaml" ].each do |tsuffix|
95
- config.task "#{task_name}#{tsuffix}" do
96
- after "#{task_name}#{tsuffix}", "#{task_name}.#{current_pod}#{tsuffix}"
82
+ if node_filter.nil? || node_filter.call(n)
83
+ config.task "#{task_name}.#{pod_name}" do
84
+ role :app, remote_name
85
+ end
86
+
87
+ config.task "#{task_name}.#{pod_name}.echo" do
88
+ puts "#{AlphaOmega.magic_prefix} #{remote_name}"
89
+ end
90
+
91
+ config.task "#{task_name}.#{pod_name}.yaml" do
92
+ StringIO.new({ remote_name => n }.to_yaml).lines.each {|l| puts "#{AlphaOmega.magic_prefix} #{l}" }
93
+ end
94
+
95
+ [ "", ".echo", ".yaml" ].each do |tsuffix|
96
+ config.task "#{task_name}#{tsuffix}" do
97
+ after "#{task_name}#{tsuffix}", "#{task_name}.#{current_pod}#{tsuffix}"
98
+ end
97
99
  end
98
- end
99
100
 
100
- n
101
+ puts "found #{n["node_name"]}"
102
+ n
103
+ else
104
+ nil
105
+ end
101
106
  end
102
107
 
103
108
  AlphaOmega.what_groups hosts do |task_name, nodes|
@@ -162,9 +167,9 @@ module AlphaOmega
162
167
  end
163
168
  end
164
169
 
165
- def self.setup_pods (config, node_home, mix_pods = true)
170
+ def self.setup_pods (config, node_home, mix_pods = true, &node_filter)
166
171
  self.what_pods(config, node_home) do |config, pod_name, pod, pods_config, opsdb, this_pod|
167
- self.default_pods_tasks.call(config, pod_name, pod, mix_pods, pods_config, opsdb, this_pod)
172
+ self.default_pods_tasks.call(config, pod_name, pod, mix_pods, pods_config, opsdb, this_pod, &node_filter)
168
173
  end
169
174
  end
170
175
 
@@ -237,7 +242,8 @@ module AlphaOmega
237
242
  node = YAML.load(IO.read(fname))
238
243
  node["node_name"] = node_name
239
244
 
240
- acc[node_name] = yield node_name, "#{node_name}#{pod["node_suffix"]}", node unless node["virtual"]
245
+ n = yield node_name, "#{node_name}#{pod["node_suffix"]}", node unless node["virtual"]
246
+ acc[node_name] = n if n
241
247
  acc
242
248
  end
243
249
  end
@@ -1,3 +1,3 @@
1
1
  module AlphaOmega
2
- Version = "0.0.76"
2
+ Version = "0.0.77"
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: 135
4
+ hash: 133
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 76
10
- version: 0.0.76
9
+ - 77
10
+ version: 0.0.77
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem