deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Main <im...@redhat.com>
Subject [PATCH] Use full paths to access config files for Condor driver.
Date Thu, 22 Dec 2011 19:06:00 GMT
This patch uses the full paths to access the various condor config
files.  Before the server was failing because the relative paths
were not working in production mode because the daemon would cwd to /.

Signed-off-by: Ian Main <imain@redhat.com>
---
 .../lib/deltacloud/drivers/condor/condor_client.rb |    3 ++-
 .../drivers/condor/ip_agents/confserver.rb         |    3 ++-
 .../deltacloud/drivers/condor/ip_agents/default.rb |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/drivers/condor/condor_client.rb b/server/lib/deltacloud/drivers/condor/condor_client.rb
index c962d03..a98f852 100644
--- a/server/lib/deltacloud/drivers/condor/condor_client.rb
+++ b/server/lib/deltacloud/drivers/condor/condor_client.rb
@@ -41,7 +41,8 @@ module CondorCloud
     CONDOR_SUBMIT_CMD = ENV['CONDOR_SUBMIT_CMD'] || 'condor_submit'
 
     # This directory needs to be readable for user running Deltacloud API
-    CONDOR_CONFIG = ENV['CONDOR_CONFIG'] || 'config/condor.yaml'
+    top_srcdir = File.join(File.dirname(__FILE__), '..', '..', '..', '..')
+    CONDOR_CONFIG = ENV['CONDOR_CONFIG'] || File.join(top_srcdir, 'config', 'condor.yaml')
 
     attr_accessor :ip_agent
     attr_reader :config
diff --git a/server/lib/deltacloud/drivers/condor/ip_agents/confserver.rb b/server/lib/deltacloud/drivers/condor/ip_agents/confserver.rb
index 9854042..7a0136d 100644
--- a/server/lib/deltacloud/drivers/condor/ip_agents/confserver.rb
+++ b/server/lib/deltacloud/drivers/condor/ip_agents/confserver.rb
@@ -28,7 +28,8 @@ module CondorCloud
       @version = @config[:ip_agent_version] || '0.0.1'
       @client = RestClient::Resource::new(self.CondorAddress)
       # TODO: Manage MAC CondorAddresses through ConfServer
-      @mappings = Nokogiri::XML(File.open(opts[:file] || File.join('config', 'CondorAddresses.xml')))
+      top_srcdir = File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..')
+      @mappings = Nokogiri::XML(File.open(opts[:file] || File.join(top_srcdir, 'config',
'CondorAddresses.xml')))
     end
 
     def find_ip_by_mac(uuid)
diff --git a/server/lib/deltacloud/drivers/condor/ip_agents/default.rb b/server/lib/deltacloud/drivers/condor/ip_agents/default.rb
index 0d0ad69..adce3a7 100644
--- a/server/lib/deltacloud/drivers/condor/ip_agents/default.rb
+++ b/server/lib/deltacloud/drivers/condor/ip_agents/default.rb
@@ -41,7 +41,8 @@ module CondorCloud
   class DefaultIPAgent < IPAgent
 
     def initialize(opts={})
-      @mappings = Nokogiri::XML(File.open(opts[:file] || File.join('config', 'addresses.xml')))
+      top_srcdir = File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..')
+      @mappings = Nokogiri::XML(File.open(opts[:file] || File.join(top_srcdir, 'config',
'addresses.xml')))
     end
 
     def find_free_mac
-- 
1.7.7.4


Mime
View raw message