libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r926943 - /incubator/libcloud/trunk/libcloud/drivers/softlayer.py
Date Wed, 24 Mar 2010 05:59:31 GMT
Author: pquerna
Date: Wed Mar 24 05:59:31 2010
New Revision: 926943

URL: http://svn.apache.org/viewvc?rev=926943&view=rev
Log:
Better handle http/https switching of the api prefix

Modified:
    incubator/libcloud/trunk/libcloud/drivers/softlayer.py

Modified: incubator/libcloud/trunk/libcloud/drivers/softlayer.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/softlayer.py?rev=926943&r1=926942&r2=926943&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/softlayer.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/softlayer.py Wed Mar 24 05:59:31 2010
@@ -23,6 +23,7 @@ from libcloud.types import Provider, Inv
 from libcloud.base import NodeDriver, Node, NodeLocation
 
 API_PREFIX = "http://api.service.softlayer.com/xmlrpc/v3"
+API_PREFIX = "https://slprxy0.cloudkick.com/xmlrpc/v3"
 
 DATACENTERS = {
     'sea01': {'country': 'US'},
@@ -33,17 +34,23 @@ DATACENTERS = {
 class SoftLayerException(Exception):
     pass
 
-class SoftLayerTransport(xmlrpclib.SafeTransport):
+class SoftLayerSafeTransport(xmlrpclib.SafeTransport):
+    user_agent = "libcloud/%s (SoftLayer)" % libcloud.__version__
+
+class SoftLayerTransport(xmlrpclib.Transport):
     user_agent = "libcloud/%s (SoftLayer)" % libcloud.__version__
 
 class SoftLayerProxy(xmlrpclib.ServerProxy):
-    transportCls = SoftLayerTransport
+    transportCls = (SoftLayerTransport, SoftLayerSafeTransport)
 
     def __init__(self, service, verbose=0):
+        cls = self.transportCls[0]
+        if API_PREFIX[:8] == "https://":
+          cls = self.transportCls[1]
         xmlrpclib.ServerProxy.__init__(
             self,
             uri="%s/%s" % (API_PREFIX, service),
-            transport=self.transportCls(use_datetime=0),
+            transport=cls(use_datetime=0),
             verbose=verbose
         )
 



Mime
View raw message