diff --git a/src/authm_mad/test/one_usage_spec.rb b/src/authm_mad/test/one_usage_spec.rb index 3b56a344ff..1a68229128 100644 --- a/src/authm_mad/test/one_usage_spec.rb +++ b/src/authm_mad/test/one_usage_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -21,7 +23,7 @@ require 'one_usage' describe "OneUsage" do before(:all) do - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @one_usage=OneUsage.new(client) end diff --git a/src/authm_mad/test/quota_spec.rb b/src/authm_mad/test/quota_spec.rb index 6bb1b7fc3d..7743e45622 100644 --- a/src/authm_mad/test/quota_spec.rb +++ b/src/authm_mad/test/quota_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -30,7 +32,7 @@ end describe 'Quota' do before(:all) do @db=Sequel.sqlite - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @quota=Quota.new(@db, client) end diff --git a/src/authm_mad/test/simple_permissions_spec.rb b/src/authm_mad/test/simple_permissions_spec.rb index b2164713b5..75a63bf2b6 100644 --- a/src/authm_mad/test/simple_permissions_spec.rb +++ b/src/authm_mad/test/simple_permissions_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -64,7 +66,7 @@ end describe SimplePermissions do before(:all) do @db=Sequel.sqlite - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @perm=SimplePermissions.new(@db, client, YAML::load(CONF)) end diff --git a/src/authm_mad/test/spec_common.rb b/src/authm_mad/test/spec_common.rb index 016ff885d1..80850db4fd 100644 --- a/src/authm_mad/test/spec_common.rb +++ b/src/authm_mad/test/spec_common.rb @@ -16,10 +16,11 @@ require 'pp' +$: << '../../oca/ruby' +$: << '..' + require 'db_helpers' -$: << '../oca/ruby' -$: << './spec' diff --git a/src/mad/ruby/CommandManager.rb b/src/mad/ruby/CommandManager.rb index d08c6988dc..e8e62ab818 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,10 +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 - cmd.run + update_remotes(host, remote_dir, logger) end sleep 1 @@ -196,9 +184,26 @@ class RemotesCommand < SSHCommand cmd end - def update_remotes(host, remote_dir, logger=nil) - log("Remote worker node files not found") - log("Updating remotes") +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) + if logger != nil + logger.call("Remote worker node files not found") + logger.call("Updating remotes") + end + + #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}" diff --git a/src/mad/ruby/OpenNebulaDriver.rb b/src/mad/ruby/OpenNebulaDriver.rb index ad44359d3c..7b32ad705a 100644 --- a/src/mad/ruby/OpenNebulaDriver.rb +++ b/src/mad/ruby/OpenNebulaDriver.rb @@ -149,7 +149,7 @@ class OpenNebulaDriver < ActionManager if action_is_local? aname local_action(command, id, aname) else - remotes_action(command, id, host, aname, @remote_scripts_path, + remotes_action(command, id, host, aname, @remote_scripts_base_path, options[:stdin]) end end diff --git a/src/mad/ruby/test/OpenNebulaDriver_spec.rb b/src/mad/ruby/test/OpenNebulaDriver_spec.rb index 408b907337..6b1efffce6 100644 --- a/src/mad/ruby/test/OpenNebulaDriver_spec.rb +++ b/src/mad/ruby/test/OpenNebulaDriver_spec.rb @@ -1,4 +1,5 @@ +$: << '..' require 'OpenNebulaDriver' require 'test/MonkeyPatcher' @@ -26,7 +27,7 @@ class OpenNebulaDriver def read_configuration old_one_location=ENV['ONE_LOCATION'] - ENV['ONE_LOCATION']=File.join(ENV['PWD'], 'test', 'fixtures') + ENV['ONE_LOCATION']=File.join(ENV['PWD'], 'fixtures') result=read_configuration_old ENV['ONE_LOCATION']=old_one_location result