From 4712e497eb0f261b8f799b1233afb83e1b77df36 Mon Sep 17 00:00:00 2001
From: Gaetan SIMO <gaetan.simo@inria.fr>
Date: Fri, 23 Mar 2012 17:51:43 +0100
Subject: [PATCH] [Rakefile] Adding '-p comment=OK' for all new node, via 'rake
 oar:generate' task

---
 Rakefile                        | 9 +++++----
 generators/lib/grid5000/node.rb | 3 ++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Rakefile b/Rakefile
index e840069b844..4168d5cbf68 100644
--- a/Rakefile
+++ b/Rakefile
@@ -60,7 +60,8 @@ namespace :deadnodes do
 
   task :browse do
     def comment_ok?(comment)
-      comment.nil? or comment == "OK"
+#      comment.nil? or comment == "OK"
+      comment == "OK" 
     end
     @api_sites.each do |site|
       site.status["nodes"].each do |uid,status|
@@ -68,15 +69,15 @@ namespace :deadnodes do
         state = status["hard"].downcase
         if comment_ok?(comment)
           if state == "dead"
-            @logger.error "Node '#{uid}' has comment 'OK', so its state should not be 'Dead' " if @tofix
+            @logger.error "Node '#{uid}' of state '#{state}' should not have comment '#{comment.inspect}'" if @tofix
           else
             # nothing, good state
           end
         else
           if state == "dead"
-            @logger.info "Node '#{uid}' is dead because '#{comment}'" if @reasons
+            @logger.info "Node '#{uid}' is dead because '#{comment.inspect}'" if @reasons
           else
-            @logger.error "Node '#{uid}' has comment not 'OK'. so its state should be 'Dead'. Instead its state is '#{state}'" if @tofix
+            @logger.error "Node '#{uid}' should have the not-dead-comment 'OK', since its state is '#{state}'. Instead, it has comment '#{comment.inspect}'." if @tofix
           end
         end
       end
diff --git a/generators/lib/grid5000/node.rb b/generators/lib/grid5000/node.rb
index 6f16516d918..651948c7545 100644
--- a/generators/lib/grid5000/node.rb
+++ b/generators/lib/grid5000/node.rb
@@ -43,6 +43,7 @@ module Grid5000
         h['memcore']         = properties['main_memory']['ram_size']/properties['architecture']['smt_size']/MiB
         h['memcpu']          = properties['main_memory']['ram_size']/properties['architecture']['smp_size']/MiB
         h['memnode']         = properties['main_memory']['ram_size']/MiB
+        h['comment']         = properties['comment'] || "OK"
         h
       }
     }
@@ -61,4 +62,4 @@ module Grid5000
     end
   end
 
-end
\ No newline at end of file
+end
-- 
GitLab