You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Ian Main <im...@redhat.com> on 2011/12/22 20:06:00 UTC

[PATCH] Use full paths to access config files for Condor driver.

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 <im...@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


Re: [PATCH] Use full paths to access config files for Condor driver.

Posted by Michal Fojtik <mf...@redhat.com>.
On Dec 22, 2011, at 8:06 PM, Ian Main wrote:

ACK.

 -- Michal

> 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 <im...@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
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org