From c81a9edd1f788c3ba034c56000bcff82b940c1c8 Mon Sep 17 00:00:00 2001 From: Florent Flament <florent.flament-ext@cloudwatt.com> Date: Fri, 11 Oct 2013 14:06:35 +0200 Subject: [PATCH] Fixes python-swiftclient debugging message Appends the container's name to the URL displayed, to be used to replay the queries with curl. Replaying the curl commands displayed by "swift --debug list <container>" now works properly. Example: $ swift --debug list test-container ... DEBUG:swiftclient:REQ: curl -i http://10.0.48.134:8080/v1/AUTH_6c554b8dd3d74e44878eddb92caf8687/test-container?format=json -X GET -H ... ... Change-Id: I7ec33d185fedc44a529c016d38f841fde39d20d0 Closes-Bug: #1238612 --- swiftclient/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swiftclient/client.py b/swiftclient/client.py index a95ce707..32827d19 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -528,7 +528,8 @@ def get_container(url, token, container, marker=None, limit=None, conn.request(method, '%s?%s' % (cont_path, qs), '', headers) resp = conn.getresponse() body = resp.read() - http_log(('%s?%s' % (url, qs), method,), {'headers': headers}, resp, body) + http_log(('%s%s?%s' % (url.replace(parsed.path, ''), cont_path, qs), + method,), {'headers': headers}, resp, body) if resp.status < 200 or resp.status >= 300: raise ClientException('Container GET failed',