libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1209933 - in /libcloud/branches/py3k/libcloud/compute/drivers: brightbox.py rimuhosting.py
Date Sat, 03 Dec 2011 15:30:28 GMT
Author: tomaz
Date: Sat Dec  3 15:30:27 2011
New Revision: 1209933

URL: http://svn.apache.org/viewvc?rev=1209933&view=rev
Log:
More progress, map calls needs to be wrapped inside list().

Modified:
    libcloud/branches/py3k/libcloud/compute/drivers/brightbox.py
    libcloud/branches/py3k/libcloud/compute/drivers/rimuhosting.py

Modified: libcloud/branches/py3k/libcloud/compute/drivers/brightbox.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/libcloud/compute/drivers/brightbox.py?rev=1209933&r1=1209932&r2=1209933&view=diff
==============================================================================
--- libcloud/branches/py3k/libcloud/compute/drivers/brightbox.py (original)
+++ libcloud/branches/py3k/libcloud/compute/drivers/brightbox.py Sat Dec  3 15:30:27 2011
@@ -58,8 +58,8 @@ class BrightboxConnection(ConnectionUser
     def _fetch_oauth_token(self):
         body = json.dumps({'client_id': self.user_id, 'grant_type': 'none'})
 
-        authorization = 'Basic ' + base64.encodestring(b('%s:%s' %
-                                        (self.user_id, self.key))).rstrip()
+        authorization = 'Basic ' + str(base64.encodestring(b('%s:%s' %
+                                        (self.user_id, self.key)))).rstrip()
 
         self.connect()
 
@@ -78,7 +78,7 @@ class BrightboxConnection(ConnectionUser
         else:
             message = '%s (%s)' % (json.loads(response.read())['error'], response.status)
 
-            raise InvalidCredsError, message
+            raise InvalidCredsError(message)
 
     def add_default_headers(self, headers):
         try:
@@ -117,8 +117,10 @@ class BrightboxNodeDriver(NodeDriver):
             id = data['id'],
             name = data['name'],
             state = self.NODE_STATE_MAP[data['status']],
-            public_ips = map(lambda cloud_ip: cloud_ip['public_ip'], data['cloud_ips']),
-            private_ips = map(lambda interface: interface['ipv4_address'], data['interfaces']),
+            public_ips = list(map(lambda cloud_ip: cloud_ip['public_ip'],
+                                                   data['cloud_ips'])),
+            private_ips = list(map(lambda interface: interface['ipv4_address'],
+                                                     data['interfaces'])),
             driver = self.connection.driver,
             extra = {
                 'status': data['status'],
@@ -186,22 +188,22 @@ class BrightboxNodeDriver(NodeDriver):
     def list_nodes(self):
         data = self.connection.request('/%s/servers' % API_VERSION).object
 
-        return map(self._to_node, data)
+        return list(map(self._to_node, data))
 
     def list_images(self):
         data = self.connection.request('/%s/images' % API_VERSION).object
 
-        return map(self._to_image, data)
+        return list(map(self._to_image, data))
 
     def list_sizes(self):
         data = self.connection.request('/%s/server_types' % API_VERSION).object
 
-        return map(self._to_size, data)
+        return list(map(self._to_size, data))
 
     def list_locations(self):
         data = self.connection.request('/%s/zones' % API_VERSION).object
 
-        return map(self._to_location, data)
+        return list(map(self._to_location, data))
 
     def ex_list_cloud_ips(self):
         return self.connection.request('/%s/cloud_ips' % API_VERSION).object

Modified: libcloud/branches/py3k/libcloud/compute/drivers/rimuhosting.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/libcloud/compute/drivers/rimuhosting.py?rev=1209933&r1=1209932&r2=1209933&view=diff
==============================================================================
--- libcloud/branches/py3k/libcloud/compute/drivers/rimuhosting.py (original)
+++ libcloud/branches/py3k/libcloud/compute/drivers/rimuhosting.py Sat Dec  3 15:30:27 2011
@@ -167,20 +167,20 @@ class RimuHostingNodeDriver(NodeDriver):
             location = ";dc_location=%s" % (location.id)
 
         res = self.connection.request('/pricing-plans;server-type=VPS%s' % (location)).object
-        return map(lambda x : self._to_size(x), res['pricing_plan_infos'])
+        return list(map(lambda x : self._to_size(x), res['pricing_plan_infos']))
 
     def list_nodes(self):
         # Returns a list of Nodes
         # Will only include active ones.
         res = self.connection.request('/orders;include_inactive=N').object
-        return map(lambda x : self._to_node(x), res['about_orders'])
+        return list(map(lambda x : self._to_node(x), res['about_orders']))
 
     def list_images(self, location=None):
         # Get all base images.
         # TODO: add other image sources. (Such as a backup of a VPS)
         # All Images are available for use at all locations
         res = self.connection.request('/distributions').object
-        return map(lambda x : self._to_image(x), res['distro_infos'])
+        return list(map(lambda x : self._to_image(x), res['distro_infos']))
 
     def reboot_node(self, node):
         # Reboot



Mime
View raw message