From 58a7ac2733372d61de13a4f1721ab72569813f65 Mon Sep 17 00:00:00 2001 From: Stavros Sachtouris Date: Wed, 27 Feb 2013 15:07:13 +0200 Subject: [PATCH] Add / at the end of images path (plankton) This bug was produced after changes in path4url, where a trailing / is now always removed --- kamaki/clients/__init__.py | 3 ++- kamaki/clients/image.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kamaki/clients/__init__.py b/kamaki/clients/__init__.py index 5ffe57f..b2e2f72 100644 --- a/kamaki/clients/__init__.py +++ b/kamaki/clients/__init__.py @@ -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, diff --git a/kamaki/clients/image.py b/kamaki/clients/image.py index c432282..6d460f3 100644 --- a/kamaki/clients/image.py +++ b/kamaki/clients/image.py @@ -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) -- 1.7.10.4