You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2012/02/14 14:25:32 UTC
[PATCH 2/3] Minor edit to OpenNebula driver - allows use of API_PROVIDER environment variable.
From: marios <ma...@redhat.com>
Can use either API_PROVIDER (or -P option to deltacloudd) or OCCI_URL environment variables
to specify location of the OpenNebula server. If both are set, OCCI_URL will take precendence.
Signed-off-by: marios <ma...@redhat.com>
---
.../deltacloud/drivers/opennebula/occi_client.rb | 9 ++-------
.../drivers/opennebula/opennebula_driver.rb | 2 +-
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/server/lib/deltacloud/drivers/opennebula/occi_client.rb b/server/lib/deltacloud/drivers/opennebula/occi_client.rb
index 3eab5d7..574cb88 100644
--- a/server/lib/deltacloud/drivers/opennebula/occi_client.rb
+++ b/server/lib/deltacloud/drivers/opennebula/occi_client.rb
@@ -40,13 +40,8 @@ module OCCIClient
@timeout = timeout
# Server location
- if endpoint_str
- @endpoint = endpoint_str
- elsif ENV["OCCI_URL"]
- @endpoint = ENV["OCCI_URL"]
- else
- @endpoint = "http://localhost:4567"
- end
+ @endpoint = ENV["OCCI_URL"] || endpoint_str || Proc.new(raise "No OpenNebula Provider location configured! Client needs to set \'X-Deltacloud-Provider\' HTTP request header, OR, Deltacloud server administrator must set either the OCCI_URL or API_PROVIDER environment variables")
+#"http://localhost:4567"
# Autentication
if user && pass
diff --git a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
index 81a1290..3b00eca 100644
--- a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
+++ b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
@@ -219,7 +219,7 @@ class OpennebulaDriver < Deltacloud::BaseDriver
private
def new_client(credentials)
- OCCIClient::Client.new(nil, credentials.user, credentials.password, false)
+ OCCIClient::Client.new(api_provider, credentials.user, credentials.password, false)
end
--
1.7.6.5