Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 356d5381 authored by Lucas Nussbaum's avatar Lucas Nussbaum
Browse files

[dev] always use the first node to generate descriptions

Some clusters are heterogeneous. We sort nodes before picking the first
node to avoid cases where we would use different nodes to generate
descriptions. Apparently different ruby versions sort hashes
differently.
parent 846def82
No related branches found
No related tags found
1 merge request!1061[dev] always use the first node to generate descriptions
Pipeline #1128161 passed
......@@ -210,7 +210,8 @@ def generate_reference_api
# Add nodes details to cluster description
cluster['nodes_count'] = cluster['nodes'].length
cluster['nodes_description'] = gen_node_description(cluster['nodes'].values.first)
first_node = cluster['nodes'].values.select { |x| not x['status'] == 'retired' }.sort_by { |x| split_cluster_node(x['uid']) }.first # use first non-retired node
cluster['nodes_description'] = gen_node_description(first_node)
# Write cluster info w/o nodes entries
write_json(cluster_path.join("#{cluster_uid}.json"),
......
......@@ -52,3 +52,7 @@ class Hash
h2
end
end
def split_cluster_node(k)
[k[/(\D+)/, 1], k[/(\d+)/, 1].to_i, k[/-(\d+)/, 1].to_i]
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment