diff --git a/.gitignore b/.gitignore index 2e12a60..291e6f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /python-glanceclient-0.4.1.tar.gz +/python-glanceclient-0.5.1.tar.gz diff --git a/0001-Ensure-v1-limit-query-parameter-works-correctly.patch b/0001-Ensure-v1-limit-query-parameter-works-correctly.patch deleted file mode 100644 index 3cb6a8c..0000000 --- a/0001-Ensure-v1-limit-query-parameter-works-correctly.patch +++ /dev/null @@ -1,61 +0,0 @@ -From d64876424e87b3a7f76a9bf4d29fdacbc5ad4bc4 Mon Sep 17 00:00:00 2001 -From: Brian Lamar -Date: Wed, 15 Aug 2012 14:39:39 -0400 -Subject: [PATCH] Ensure v1 'limit' query parameter works correctly. - -The tests were present but were not asserting list results. - -page_size was overriding the absolute limit so limits were -not working if they were less than the page_size. - -Fixes bug 1037233 - -Change-Id: If102824212e3846bc65d3f7928cf7aa2e48aaa63 ---- - glanceclient/v1/images.py | 6 ++++-- - tests/v1/test_images.py | 5 +++-- - 2 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/glanceclient/v1/images.py b/glanceclient/v1/images.py -index a4b759a..b41b314 100644 ---- a/glanceclient/v1/images.py -+++ b/glanceclient/v1/images.py -@@ -123,18 +123,20 @@ class ImageManager(base.Manager): - structure of an image object - :rtype: list of :class:`Image` - """ -- limit = kwargs.get('limit') -+ absolute_limit = kwargs.get('limit') - - def paginate(qp, seen=0): - url = '/v1/images/detail?%s' % urllib.urlencode(qp) - images = self._list(url, "images") - for image in images: - seen += 1 -+ if absolute_limit is not None and seen > absolute_limit: -+ return - yield image - - page_size = qp.get('limit') - if (page_size and len(images) == page_size and -- (limit is None or 0 < seen < limit)): -+ (absolute_limit is None or 0 < seen < absolute_limit)): - qp['marker'] = image.id - for image in paginate(qp, seen): - yield image -diff --git a/tests/v1/test_images.py b/tests/v1/test_images.py -index 6f258e6..759010f 100644 ---- a/tests/v1/test_images.py -+++ b/tests/v1/test_images.py -@@ -223,8 +223,9 @@ class ImageManagerTest(unittest.TestCase): - self.assertEqual(images[2].id, 'c') - - def test_list_with_limit_less_than_page_size(self): -- list(self.mgr.list(page_size=20, limit=10)) -- expect = [('GET', '/v1/images/detail?limit=20', {}, None)] -+ results = list(self.mgr.list(page_size=2, limit=1)) -+ expect = [('GET', '/v1/images/detail?limit=2', {}, None)] -+ self.assertEqual(1, len(results)) - self.assertEqual(self.api.calls, expect) - - def test_list_with_limit_greater_than_page_size(self): diff --git a/0001-Make-ConnectionRefused-error-more-informative.patch b/0001-Make-ConnectionRefused-error-more-informative.patch new file mode 100644 index 0000000..d27871f --- /dev/null +++ b/0001-Make-ConnectionRefused-error-more-informative.patch @@ -0,0 +1,91 @@ +From 8cee48b1ddf480d182bbc33ec684dcfd195b038c Mon Sep 17 00:00:00 2001 +From: Andrew Laski +Date: Wed, 12 Sep 2012 09:40:04 -0400 +Subject: [PATCH] Make ConnectionRefused error more informative. + +When the server refuses the connection the error message displayed now +lists the endpoint that refused the connection. + +Fixes: bug 1043067 +Change-Id: I62797106732bbb6eec8c99e491fd38850ad58ff8 +--- + glanceclient/common/http.py | 3 +- + tests/test_http.py | 55 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+), 1 deletions(-) + create mode 100644 tests/test_http.py + +diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py +index d81ac9a..4349e86 100644 +--- a/glanceclient/common/http.py ++++ b/glanceclient/common/http.py +@@ -140,7 +140,8 @@ class HTTPClient(object): + message = "Error finding address for %(url)s: %(e)s" % locals() + raise exc.InvalidEndpoint(message=message) + except (socket.error, socket.timeout) as e: +- message = "Error communicating with %(url)s: %(e)s" % locals() ++ endpoint = self.endpoint ++ message = "Error communicating with %(endpoint)s %(e)s" % locals() + raise exc.CommunicationError(message=message) + + body_iter = ResponseBodyIterator(resp) +diff --git a/tests/test_http.py b/tests/test_http.py +new file mode 100644 +index 0000000..c727c6a +--- /dev/null ++++ b/tests/test_http.py +@@ -0,0 +1,55 @@ ++# Copyright 2012 OpenStack LLC. ++# All Rights Reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); you may ++# not use this file except in compliance with the License. You may obtain ++# a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ++# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ++# License for the specific language governing permissions and limitations ++# under the License. ++ ++import httplib ++import socket ++import unittest ++ ++import mox ++ ++from glanceclient import exc ++from glanceclient.common import http ++ ++ ++class TestClient(unittest.TestCase): ++ def test_connection_refused(self): ++ """ ++ Should receive a CommunicationError if connection refused. ++ And the error should list the host and port that refused the ++ connection ++ """ ++ endpoint = 'http://example.com:9292' ++ client = http.HTTPClient(endpoint, token=u'abc123') ++ m = mox.Mox() ++ m.StubOutWithMock(httplib.HTTPConnection, 'request') ++ httplib.HTTPConnection.request( ++ mox.IgnoreArg(), ++ mox.IgnoreArg(), ++ headers=mox.IgnoreArg(), ++ ).AndRaise(socket.error()) ++ m.ReplayAll() ++ try: ++ client.json_request('GET', '/v1/images/detail?limit=20') ++ #NOTE(alaski) We expect exc.CommunicationError to be raised ++ # so we should never reach this point. try/except is used here ++ # rather than assertRaises() so that we can check the body of ++ # the exception. ++ self.fail('An exception should have bypassed this line.') ++ except exc.CommunicationError, comm_err: ++ fail_msg = ("Exception message '%s' should contain '%s'" % ++ (comm_err.message, endpoint)) ++ self.assertTrue(endpoint in comm_err.message, fail_msg) ++ finally: ++ m.UnsetStubs() diff --git a/0002-Enable-client-V1-to-download-images.patch b/0002-Enable-client-V1-to-download-images.patch deleted file mode 100644 index 52e3c6b..0000000 --- a/0002-Enable-client-V1-to-download-images.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 77c8e3f023daec1cabf07eeaeb55c3a45af311a1 Mon Sep 17 00:00:00 2001 -From: Lars Gellrich -Date: Mon, 13 Aug 2012 09:21:58 +0000 -Subject: [PATCH] Enable client V1 to download images - -Added the CLI option image-download to download an image via API V1. -Based on commit 137b3cf975d73437943e100065c76b83acfa7dd3 - -Related to bp glance-client-v2 - -Change-Id: Ie587e208ad7433e468798cd9b1846b4a21e1c4ec ---- - glanceclient/v1/shell.py | 11 +++++++++++ - 1 files changed, 11 insertions(+), 0 deletions(-) - -diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py -index c521ea2..e131a08 100644 ---- a/glanceclient/v1/shell.py -+++ b/glanceclient/v1/shell.py -@@ -77,6 +77,17 @@ def do_image_show(gc, args): - _image_show(image) - - -+@utils.arg('--file', metavar='', -+ help='Local file to save downloaded image data to. ' -+ 'If this is not specified the image data will be ' -+ 'written to stdout.') -+@utils.arg('id', metavar='', help='ID of image to download.') -+def do_image_download(gc, args): -+ """Download a specific image.""" -+ body = gc.images.data(args.id) -+ utils.save_image(body, args.file) -+ -+ - @utils.arg('--id', metavar='', - help='ID of image to reserve.') - @utils.arg('--name', metavar='', diff --git a/0002-Fix-weird-None-displayed-on-some-errors.patch b/0002-Fix-weird-None-displayed-on-some-errors.patch new file mode 100644 index 0000000..0a7f92c --- /dev/null +++ b/0002-Fix-weird-None-displayed-on-some-errors.patch @@ -0,0 +1,28 @@ +From 902bff79bbe52e831da947bb5ac5fce2330d810e Mon Sep 17 00:00:00 2001 +From: Vincent Untz +Date: Thu, 13 Sep 2012 11:12:00 +0200 +Subject: [PATCH] Fix weird "None" displayed on some errors + +logging.exception() should only be called from an exception handler, +which is not the case here. + +Part of bug 1050260. + +Change-Id: I591a68c458cd733c04cea7d2d640afdbb7dd19f6 +--- + glanceclient/common/http.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py +index 4349e86..4a6ce53 100644 +--- a/glanceclient/common/http.py ++++ b/glanceclient/common/http.py +@@ -155,7 +155,7 @@ class HTTPClient(object): + self.log_http_response(resp) + + if 400 <= resp.status < 600: +- LOG.exception("Request returned failure status.") ++ LOG.error("Request returned failure status.") + raise exc.from_response(resp) + elif resp.status in (301, 302, 305): + # Redirected. Reissue the request to the new location. diff --git a/0003-Typo-in-image-create-help-page.patch b/0003-Typo-in-image-create-help-page.patch new file mode 100644 index 0000000..9ca9450 --- /dev/null +++ b/0003-Typo-in-image-create-help-page.patch @@ -0,0 +1,31 @@ +From cdc94af297fe56341dfe0484d62f2e69d9aa5e9b Mon Sep 17 00:00:00 2001 +From: Stuart McLaren +Date: Mon, 17 Sep 2012 13:39:33 +0000 +Subject: [PATCH] Typo in image-create help page + +The image-create help page reversed the DISK_FORMAT +and CONTAINER_FORMAT metavars. + +Fixes bug 1051968. + +Change-Id: I385cb0912ad87a62fd10742b5da23a5ea8bc9bb8 +--- + glanceclient/v1/shell.py | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py +index 3646f9f..500014c 100644 +--- a/glanceclient/v1/shell.py ++++ b/glanceclient/v1/shell.py +@@ -92,9 +92,9 @@ def do_image_download(gc, args): + help='ID of image to reserve.') + @utils.arg('--name', metavar='', + help='Name of image.') +-@utils.arg('--disk-format', metavar='', ++@utils.arg('--disk-format', metavar='', + help='Disk format of image.') +-@utils.arg('--container-format', metavar='', ++@utils.arg('--container-format', metavar='', + help='Container format of image.') + @utils.arg('--owner', metavar='', + help='Tenant who should own image.') diff --git a/0003-Update-pip-requires-with-warlock-2.patch b/0003-Update-pip-requires-with-warlock-2.patch deleted file mode 100644 index 4c1054e..0000000 --- a/0003-Update-pip-requires-with-warlock-2.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 5e6638d9c32a223c2e9be4190de78f5afee65cdc Mon Sep 17 00:00:00 2001 -From: Dan Prince -Date: Fri, 17 Aug 2012 11:50:33 -0400 -Subject: [PATCH] Update pip-requires with warlock<2. - -Allow warlock to be used up to version 2 (the next -major version of the library). - -Change-Id: I0c5a47f9ebfa0145dfab7310a22982d5d8e9aa52 ---- - tools/pip-requires | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/tools/pip-requires b/tools/pip-requires -index a1f3536..bbb4edf 100644 ---- a/tools/pip-requires -+++ b/tools/pip-requires -@@ -1,4 +1,4 @@ - argparse - prettytable>=0.6,<0.7 - python-keystoneclient>=0.1.2,<0.2 --warlock==0.1.0 -+warlock<2 diff --git a/0004-Update-command-descriptions.patch b/0004-Update-command-descriptions.patch deleted file mode 100644 index b45c3c0..0000000 --- a/0004-Update-command-descriptions.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 012efff130e1d8c6a9672df3c2c616a405acea0d Mon Sep 17 00:00:00 2001 -From: Brian Waldon -Date: Tue, 21 Aug 2012 13:07:08 -0700 -Subject: [PATCH] Update command descriptions - -Several commands did not have descriptions or the descriptions -they had were insufficient. This adds mission descriptions -and fattens up those that were too lean. - -Change-Id: I091ae70cdae5d3f72f273519d88873cb5392ba3b ---- - glanceclient/v1/legacy_shell.py | 1 + - glanceclient/v1/shell.py | 7 ++++++- - glanceclient/v2/shell.py | 2 +- - 3 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/glanceclient/v1/legacy_shell.py b/glanceclient/v1/legacy_shell.py -index 030cee4..b6f3903 100644 ---- a/glanceclient/v1/legacy_shell.py -+++ b/glanceclient/v1/legacy_shell.py -@@ -249,6 +249,7 @@ def do_delete(gc, args): - - @utils.arg('id', metavar='', help='ID of image to describe.') - def do_show(gc, args): -+ """DEPRECATED! Use image-show instead.""" - image = gc.images.get(args.id) - print_image_formatted(gc, image) - return SUCCESS -diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py -index e131a08..3646f9f 100644 ---- a/glanceclient/v1/shell.py -+++ b/glanceclient/v1/shell.py -@@ -42,7 +42,7 @@ from glanceclient.v1.legacy_shell import * - @utils.arg('--page-size', metavar='', default=None, type=int, - help='Number of images to request in each paginated request.') - def do_image_list(gc, args): -- """List images.""" -+ """List images you can access.""" - filter_keys = ['name', 'status', 'container_format', 'disk_format', - 'size_min', 'size_max'] - filter_items = [(key, getattr(args, key)) for key in filter_keys] -@@ -132,6 +132,7 @@ def do_image_download(gc, args): - help=("Arbitrary property to associate with image. " - "May be used multiple times.")) - def do_image_create(gc, args): -+ """Create a new image.""" - # Filter out None values - fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) - -@@ -202,6 +203,7 @@ def do_image_create(gc, args): - "not explicitly set in the update request. Otherwise, " - "those properties not referenced are preserved.")) - def do_image_update(gc, args): -+ """Update a specific image.""" - # Filter out None values - fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) - -@@ -241,6 +243,7 @@ def do_image_delete(gc, args): - @utils.arg('--tenant-id', metavar='', - help='Filter results by a tenant ID.') - def do_member_list(gc, args): -+ """Describe sharing permissions by image or tenant.""" - if args.image_id and args.tenant_id: - print 'Unable to filter members by both --image-id and --tenant-id.' - sys.exit(1) -@@ -264,6 +267,7 @@ def do_member_list(gc, args): - @utils.arg('--can-share', action='store_true', default=False, - help='Allow the specified tenant to share this image.') - def do_member_create(gc, args): -+ """Share a specific image with a tenant.""" - gc.image_members.create(args.image_id, args.tenant_id, args.can_share) - - -@@ -272,6 +276,7 @@ def do_member_create(gc, args): - @utils.arg('tenant_id', metavar='', - help='Tenant to add as member') - def do_member_delete(gc, args): -+ """Remove a shared image from a tenant.""" - if not options.dry_run: - gc.image_members.delete(args.image_id, args.tenant_id) - else: -diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py -index 63bcd13..4ed2f32 100644 ---- a/glanceclient/v2/shell.py -+++ b/glanceclient/v2/shell.py -@@ -20,7 +20,7 @@ from glanceclient import exc - @utils.arg('--page-size', metavar='', default=None, type=int, - help='Number of images to request in each paginated request.') - def do_image_list(gc, args): -- """List images.""" -+ """List images you can access.""" - kwargs = {} - if args.page_size is not None: - kwargs['page_size'] = args.page_size diff --git a/0004-adjust-egg-info-for-Fedora.patch b/0004-adjust-egg-info-for-Fedora.patch new file mode 100644 index 0000000..6a0e429 --- /dev/null +++ b/0004-adjust-egg-info-for-Fedora.patch @@ -0,0 +1,22 @@ +From b248b76d6c404578b625efc4b190161b12d9510e Mon Sep 17 00:00:00 2001 +From: Alan Pevec +Date: Thu, 23 Aug 2012 01:35:20 +0200 +Subject: [PATCH] adjust egg info for Fedora + +There is no egg info available for argparse on Fedora +so the requirement can't be satisfied. + +FEDORA SPECIFIC - do not send upstream! +--- + tools/pip-requires | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/tools/pip-requires b/tools/pip-requires +index bbb4edf..69367c6 100644 +--- a/tools/pip-requires ++++ b/tools/pip-requires +@@ -1,4 +1,3 @@ +-argparse + prettytable>=0.6,<0.7 + python-keystoneclient>=0.1.2,<0.2 + warlock<2 diff --git a/0005-adjust-egg-info-for-Fedora.patch b/0005-adjust-egg-info-for-Fedora.patch deleted file mode 100644 index 267cfe2..0000000 --- a/0005-adjust-egg-info-for-Fedora.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 6078d82488fdf503391767f910f36cf9661ffbbc Mon Sep 17 00:00:00 2001 -From: Alan Pevec -Date: Thu, 23 Aug 2012 01:35:20 +0200 -Subject: [PATCH] adjust egg info for Fedora - -There is no egg info available for argparse on Fedora -so the requirement can't be satisfied. - -FEDORA SPECIFIC - do not send upstream! ---- - tools/pip-requires | 1 - - 1 files changed, 0 insertions(+), 1 deletions(-) - -diff --git a/tools/pip-requires b/tools/pip-requires -index bbb4edf..69367c6 100644 ---- a/tools/pip-requires -+++ b/tools/pip-requires -@@ -1,4 +1,3 @@ --argparse - prettytable>=0.6,<0.7 - python-keystoneclient>=0.1.2,<0.2 - warlock<2 diff --git a/python-glanceclient.spec b/python-glanceclient.spec index ae62401..f3923a3 100644 --- a/python-glanceclient.spec +++ b/python-glanceclient.spec @@ -3,23 +3,23 @@ Name: python-glanceclient # and restarted version numbering from 0.1.1 # https://lists.launchpad.net/openstack/msg14248.html Epoch: 1 -Version: 0.4.1 +Version: 0.5.1 Release: 1%{?dist} Summary: Python API and CLI for OpenStack Glance Group: Development/Languages License: ASL 2.0 URL: http://github.com/openstack/python-glanceclient -Source0: https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz +#Source0: https://launchpad.net/%{name}/trunk/%{version}/+download/%{name}-%{version}.tar.gz +Source0: http://tarballs.openstack.org/%{name}/%{name}-%{version}.tar.gz # -# patches_base=0.4.1 +# patches_base=0.5.1 # -Patch0001: 0001-Ensure-v1-limit-query-parameter-works-correctly.patch -Patch0002: 0002-Enable-client-V1-to-download-images.patch -Patch0003: 0003-Update-pip-requires-with-warlock-2.patch -Patch0004: 0004-Update-command-descriptions.patch -Patch0005: 0005-adjust-egg-info-for-Fedora.patch +Patch0001: 0001-Make-ConnectionRefused-error-more-informative.patch +Patch0002: 0002-Fix-weird-None-displayed-on-some-errors.patch +Patch0003: 0003-Typo-in-image-create-help-page.patch +Patch0004: 0004-adjust-egg-info-for-Fedora.patch BuildArch: noarch BuildRequires: python-setuptools @@ -37,11 +37,12 @@ glanceclient module), and a command-line script (glance). Each implements %prep %setup -q + %patch0001 -p1 %patch0002 -p1 %patch0003 -p1 %patch0004 -p1 -%patch0005 -p1 + # Remove bundled egg-info rm -rf python_glanceclient.egg-info sed -i '/setuptools-git/d' setup.py @@ -63,6 +64,9 @@ rm -fr %{buildroot}%{python_sitelib}/tests %{python_sitelib}/*.egg-info %changelog +* Sat Sep 15 2012 Alan Pevec 1:0.5.1-1 +- Update to 0.5.1 + * Wed Aug 22 2012 Alan Pevec 1:0.4.1-1 - Add dependency on python-setuptools (#850844) - Revert client script rename, old glance client is now deprecated. diff --git a/sources b/sources index 0282528..b9f4d69 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c539cf7fb1a1337594004b44d8ccc451 python-glanceclient-0.4.1.tar.gz +d5d2b1bce79ae32ee9d362fc7ccc0e32 python-glanceclient-0.5.1.tar.gz