...
 
Commits (2)
......@@ -186,6 +186,21 @@ namespace :gen do
end
end
namespace :version do
desc 'Get model list, need model='
task :get do
model = ENV['model']
raise 'need model=' if model.nil?
model_filter = nodes_by_model(model)
nodes = model_filter.map { |x| { 'node' => x['uid'], 'bios' => x['bios']['version'] } }
nodes.each do |node|
puts "#{node['node']} : #{node['bios']}"
end
end
end
desc "Creates JSON data from inputs"
task "reference-api" do
require 'refrepo/gen/reference-api'
......
......@@ -39,3 +39,21 @@ def load_data_hierarchy
return global_hash
end
def nodes_by_model(model)
nodes = []
data = load_data_hierarchy
data['sites'].keys.each do |site|
puts "** #{site}"
data['sites'][site]['clusters'].each do |cluster|
c = cluster.last
c['nodes'].each do |_, v|
nodes << v
end
end
end
model_filter = nodes.select do |node|
node['chassis']['name'] =~ /#{model}/
end
model_filter
end