From e178cddf61772d51634d83dfdcb4e7bac5da5915 Mon Sep 17 00:00:00 2001
From: Cyril Rohr <cyril.rohr@irisa.fr>
Date: Mon, 15 Nov 2010 10:15:33 +0100
Subject: [PATCH] [admin] Added --auto-offset and maintenance=yes when
 generating oaradmin commands. Fixed bug (missing /).

---
 Rakefile | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/Rakefile b/Rakefile
index ce60b77d96..9c95690dfc 100644
--- a/Rakefile
+++ b/Rakefile
@@ -85,13 +85,18 @@ namespace :oar do
         if action == "M"  # modification of a file
           command.concat(" -s node=#{host} ")
         else              # new file
-          command.concat(" -a node=#{host}/cpu={#{node.properties['architecture']['smp_size']}}/core={#{export['cpucore']}} ")
+          command.concat(" -a /node=#{host}/cpu={#{node.properties['architecture']['smp_size']}}/core={#{export['cpucore']}}")
+          command.concat(" --auto-offset")
+          if ENV['MAINTENANCE'] && ENV['MAINTENANCE']=='NO'
+            command.concat(' -p maintenance="NO"')
+          else
+            # by default, maintenance is YES when creating new resources
+            command.concat(' -p maintenance="YES"')
+          end
         end
         command.concat(" -p ").concat( export.to_a.map{|(k,v)|
           if v.nil?
             nil
-          elsif v.kind_of?(String) && v =~ / / # to remove after oaradmin correctly parses options
-            [k, v.inspect.inspect].join("=")
           else
             [k, v.inspect].join("=")
           end
@@ -102,6 +107,11 @@ namespace :oar do
         @logger.warn "Don't know what to do with #{line.inspect}. Ignoring."
         next
       end
+      
+      if ENV['COMMIT'] && ENV['COMMIT']=='YES'
+        command.concat(' -c')
+      end
+      
       commands << command
     end
     commands.each do |command|
-- 
GitLab