Add / at the end of images path (plankton)
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Wed, 27 Feb 2013 13:07:13 +0000 (15:07 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Wed, 27 Feb 2013 13:16:48 +0000 (15:16 +0200)
This bug was produced after changes in path4url, where a trailing / is now
always removed

kamaki/clients/__init__.py
kamaki/clients/image.py

index 5ffe57f..b2e2f72 100644 (file)
@@ -193,7 +193,8 @@ class Client(object):
 
             sendlog.info('perform a %s @ %s', method, self.base_url)
 
-            self.http_client.url = self.base_url
+            self.http_client.url = self.base_url + (
+                '/' if (self.base_url and self.base_url[-1]) != '/' else '')
             self.http_client.path = quote(path.encode('utf8'))
             r = self.http_client.perform_request(
                 method,
index c432282..6d460f3 100644 (file)
@@ -52,7 +52,8 @@ class ImageClient(Client):
 
         :returns: (list) id,name + full image info if detail
         """
-        path = path4url('images', 'detail') if detail else path4url('images/')
+        path = path4url('images', 'detail') if detail else (
+            path4url('images') + '/')
 
         async_params = {}
         if isinstance(filters, dict):
@@ -108,7 +109,7 @@ class ImageClient(Client):
 
         :param properties: (dict) image properties (X-Image-Meta-Property)
         """
-        path = path4url('images/')
+        path = path4url('images') + '/'
         self.set_header('X-Image-Meta-Name', name)
         self.set_header('X-Image-Meta-Location', location)