From b796817b97466ddf99654d3554e434fbae8c4099 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sat, 18 Jun 2011 01:26:45 +0200 Subject: [PATCH] bug: remote dir is not recreated if removed --- src/mad/ruby/CommandManager.rb | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mad/ruby/CommandManager.rb b/src/mad/ruby/CommandManager.rb index d08c6988dc..b7f5864cfe 100644 --- a/src/mad/ruby/CommandManager.rb +++ b/src/mad/ruby/CommandManager.rb @@ -160,15 +160,6 @@ private end class RemotesCommand < SSHCommand - ONE_LOCATION=ENV["ONE_LOCATION"] - - if !ONE_LOCATION - REMOTES_LOCATION="/var/lib/one/remotes" - else - REMOTES_LOCATION=ONE_LOCATION+"/var/remotes/" - end - - MAGIC_RC = 42 # Creates a command and runs it def self.run(command, host, remote_dir, logger=nil, stdin=nil, retries=0) @@ -182,9 +173,7 @@ class RemotesCommand < SSHCommand while cmd.code != 0 and retries != 0 if cmd.code == MAGIC_RC - cmd.update_remotes(host, remote_dir, logger) - - @command = command + update_remotes(host, remote_dir, logger) cmd.run end @@ -196,10 +185,25 @@ class RemotesCommand < SSHCommand cmd end - def update_remotes(host, remote_dir, logger=nil) +private + + ONE_LOCATION=ENV["ONE_LOCATION"] + + if !ONE_LOCATION + REMOTES_LOCATION="/var/lib/one/remotes" + else + REMOTES_LOCATION=ONE_LOCATION+"/var/remotes/" + end + + MAGIC_RC = 42 + + def self.update_remotes(host, remote_dir, logger=nil) log("Remote worker node files not found") log("Updating remotes") + #recreate remote dir structure + SSHCommand.run("mkdir -p #{remote_dir}",host,logger) + # Use SCP to sync: sync_cmd = "scp -r #{REMOTES_LOCATION}/. #{host}:#{remote_dir}"