deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/4] git commit: VSphere: Make API_PROVIDER format consistent with other drivers (DTACLOUD-399)
Date Wed, 02 Jan 2013 14:41:10 GMT
VSphere: Make API_PROVIDER format consistent with other drivers (DTACLOUD-399)


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/8786328f
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/8786328f
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/8786328f

Branch: refs/heads/master
Commit: 8786328fd16ebd43e59509c0ec572a5646d04159
Parents: 4662285
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Jan 2 14:49:01 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Wed Jan 2 14:49:01 2013 +0100

----------------------------------------------------------------------
 .../deltacloud/drivers/vsphere/vsphere_driver.rb   |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8786328f/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
----------------------------------------------------------------------
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
 


Mime
View raw message