From 8abd69002d857dad2186713ccb24b252b40bcb94 Mon Sep 17 00:00:00 2001
From: Lucas Nussbaum <lucas.nussbaum@loria.fr>
Date: Wed, 6 Jun 2018 07:59:25 +0200
Subject: [PATCH] [dev/oar-properties] fix cluster selection

---
 generators/oar-properties/oar-properties-check.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/generators/oar-properties/oar-properties-check.rb b/generators/oar-properties/oar-properties-check.rb
index 1da37ad949d..c27b10f1394 100755
--- a/generators/oar-properties/oar-properties-check.rb
+++ b/generators/oar-properties/oar-properties-check.rb
@@ -28,6 +28,7 @@ end
 def parse_command_line_parameters
   options = {}
   options[:sites] = %w(grenoble lille luxembourg lyon nancy nantes rennes sophia)
+  options[:clusters] = []
 
   OptionParser.new do |opts|
     opts.banner = 'Usage: oar-properties-check.rb [options]'
@@ -100,7 +101,8 @@ options[:sites].each do |site|
   # for each host ...
   default_resources.map { |e| e['host'] }.uniq.each do |host|
     host_resources = default_resources.select { |e| e['host'] == host }
-    next if options[:clusters] and not options[:clusters].include?(host_resources['cluster'])
+    cluster = host_resources.first['cluster']
+    next if not options[:clusters].empty? and not options[:clusters].include?(cluster)
 
     # compute nbcores.
     # cpucore is cores per cpu. to know the number of cpus, we devide memnode per memcpu.
-- 
GitLab