deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 1/3] VSphere: Make API_PROVIDER format consistent with other drivers (DTACLOUD-399)
Date Wed, 02 Jan 2013 13:59:30 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index 11d2759..4f9df5f 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -409,7 +409,14 @@ module Deltacloud::Drivers::Vsphere
     end
 
     def host_endpoint
-      endpoint = api_provider
+      endpoint = "#{api_provider}"
+      # We need to have the 'hostname' form in API_PROVIDER, but to be
+      # compatible with other drivers, we allow 'https://vsphere/api' format.
+      # The 'http' and '/.*' parts are however stripped.
+      if endpoint =~ /^http/
+        endpoint.gsub!(/^http(s?):\/\//, '')
+        endpoint.gsub!(/\/.*$/, '')
+      end
       endpoint || Deltacloud::Drivers::driver_config[:vsphere][:entrypoints]['default']['default']
     end
 
-- 
1.8.0.2


Mime
View raw message