From 8f7f7bad4df2520a418259c64638dd82bdbfebaf Mon Sep 17 00:00:00 2001 From: Jakub Ruzicka Date: Mar 11 2013 15:55:54 +0000 Subject: Update to 0.8.0 pypi sources. Use 0.8.0 pypi tarball with patches from stable/folsom branch. --- diff --git a/.gitignore b/.gitignore index 291e6f1..19530ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/python-glanceclient-0.4.1.tar.gz -/python-glanceclient-0.5.1.tar.gz +/python-glanceclient-0.8.0.tar.gz diff --git a/0001-Make-ConnectionRefused-error-more-informative.patch b/0001-Make-ConnectionRefused-error-more-informative.patch deleted file mode 100644 index d27871f..0000000 --- a/0001-Make-ConnectionRefused-error-more-informative.patch +++ /dev/null @@ -1,91 +0,0 @@ -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/0001-Report-name-resolution-errors-properly.patch b/0001-Report-name-resolution-errors-properly.patch new file mode 100644 index 0000000..25c34d3 --- /dev/null +++ b/0001-Report-name-resolution-errors-properly.patch @@ -0,0 +1,88 @@ +From 0fce5e31dfba299018e5efd0ec7e263ef48bf271 Mon Sep 17 00:00:00 2001 +From: Stanislaw Pitucha +Date: Tue, 19 Feb 2013 15:40:16 +0000 +Subject: [PATCH] Report name resolution errors properly + +Errors in name resolution have been logged previously with the url path +rather than the hostname. That resulted in incorrect errors like: + +InvalidEndpoint: Error finding address for +/v1/images/detail?is_public=none&limit=20: [Errno -2] +Name or service not known + +rather than one mentioning hostname itself. This patch changes the log +message to fit the situation. + +Change-Id: I1eecbcb22d41b1341c214937b9cbfd046fd301a0 +--- + glanceclient/common/http.py | 3 ++- + tests/test_http.py | 42 ++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 44 insertions(+), 1 deletion(-) + +diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py +index 115204f..7146ace 100644 +--- a/glanceclient/common/http.py ++++ b/glanceclient/common/http.py +@@ -183,7 +183,8 @@ class HTTPClient(object): + conn.request(method, conn_url, **kwargs) + resp = conn.getresponse() + except socket.gaierror as e: +- message = "Error finding address for %(url)s: %(e)s" % locals() ++ message = "Error finding address for %s: %s" % ( ++ self.endpoint_hostname, e) + raise exc.InvalidEndpoint(message=message) + except (socket.error, socket.timeout) as e: + endpoint = self.endpoint +diff --git a/tests/test_http.py b/tests/test_http.py +index cabcf8d..3d87444 100644 +--- a/tests/test_http.py ++++ b/tests/test_http.py +@@ -83,6 +83,48 @@ class TestClient(testtools.TestCase): + self.assertEqual(resp, fake) + + ++class TestHostResolutionError(testtools.TestCase): ++ ++ def setUp(self): ++ super(TestHostResolutionError, self).setUp() ++ self.mock = mox.Mox() ++ self.invalid_host = "example.com.incorrect_top_level_domain" ++ ++ def test_incorrect_domain_error(self): ++ """ ++ Make sure that using a domain which does not resolve causes an ++ exception which mentions that specific hostname as a reason for ++ failure. ++ """ ++ class FailingConnectionClass(object): ++ def __init__(self, *args, **kwargs): ++ pass ++ ++ def putrequest(self, *args, **kwargs): ++ raise socket.gaierror(-2, "Name or service not known") ++ ++ def request(self, *args, **kwargs): ++ raise socket.gaierror(-2, "Name or service not known") ++ ++ self.endpoint = 'http://%s:9292' % (self.invalid_host,) ++ self.client = http.HTTPClient(self.endpoint, token=u'abc123') ++ ++ self.mock.StubOutWithMock(self.client, 'get_connection') ++ self.client.get_connection().AndReturn(FailingConnectionClass()) ++ self.mock.ReplayAll() ++ ++ try: ++ self.client.raw_request('GET', '/example/path') ++ self.fail("gaierror should be raised") ++ except exc.InvalidEndpoint as e: ++ self.assertTrue(self.invalid_host in str(e), ++ "exception should contain the hostname") ++ ++ def tearDown(self): ++ super(TestHostResolutionError, self).tearDown() ++ self.mock.UnsetStubs() ++ ++ + class TestResponseBodyIterator(testtools.TestCase): + def test_iter_default_chunk_size_64k(self): + resp = utils.FakeResponse({}, StringIO.StringIO('X' * 98304)) diff --git a/0002-Fix-weird-None-displayed-on-some-errors.patch b/0002-Fix-weird-None-displayed-on-some-errors.patch deleted file mode 100644 index 0a7f92c..0000000 --- a/0002-Fix-weird-None-displayed-on-some-errors.patch +++ /dev/null @@ -1,28 +0,0 @@ -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/0002-Replace-SchemaNotFound-with-HTTPNotFound.patch b/0002-Replace-SchemaNotFound-with-HTTPNotFound.patch new file mode 100644 index 0000000..a7d45a8 --- /dev/null +++ b/0002-Replace-SchemaNotFound-with-HTTPNotFound.patch @@ -0,0 +1,25 @@ +From 61fd49f43724a46040702c7a5627da2f823bb8ea Mon Sep 17 00:00:00 2001 +From: Brian Waldon +Date: Fri, 22 Feb 2013 10:21:00 -0800 +Subject: [PATCH] Replace SchemaNotFound with HTTPNotFound + +Fixes bug 1131682 + +Change-Id: I615acbef0411677cae5d30262702babd900c0c81 +--- + glanceclient/v2/shell.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py +index cb45770..12bef8c 100644 +--- a/glanceclient/v2/shell.py ++++ b/glanceclient/v2/shell.py +@@ -43,7 +43,7 @@ def do_explain(gc, args): + """Describe a specific model.""" + try: + schema = gc.schemas.get(args.model) +- except exc.SchemaNotFound: ++ except exc.HTTPNotFound: + utils.exit('Unable to find requested model \'%s\'' % args.model) + else: + formatters = {'Attribute': lambda m: m.name} diff --git a/0003-Typo-in-image-create-help-page.patch b/0003-Typo-in-image-create-help-page.patch deleted file mode 100644 index 9ca9450..0000000 --- a/0003-Typo-in-image-create-help-page.patch +++ /dev/null @@ -1,31 +0,0 @@ -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-Use-getattr-properly-in-legacy-shell.patch b/0003-Use-getattr-properly-in-legacy-shell.patch new file mode 100644 index 0000000..c1abaab --- /dev/null +++ b/0003-Use-getattr-properly-in-legacy-shell.patch @@ -0,0 +1,28 @@ +From 6df2f8c8405096528e4ded264bc38bd6ef17a7a5 Mon Sep 17 00:00:00 2001 +From: Brian Waldon +Date: Fri, 22 Feb 2013 10:15:50 -0800 +Subject: [PATCH] Use getattr properly in legacy shell + +Fixes bug 1131703 + +Change-Id: If97f422af170c29785d2bf8884fafff979031e14 +--- + glanceclient/v1/legacy_shell.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/glanceclient/v1/legacy_shell.py b/glanceclient/v1/legacy_shell.py +index 56bce65..99a1813 100644 +--- a/glanceclient/v1/legacy_shell.py ++++ b/glanceclient/v1/legacy_shell.py +@@ -266,8 +266,9 @@ def _get_images(gc, args): + + optional_kwargs = ['marker', 'sort_key', 'sort_dir'] + for kwarg in optional_kwargs: +- if getattr(args, kwarg): +- parameters[kwarg] = getattr(args.kwarg) ++ value = getattr(args, kwarg, None) ++ if value is not None: ++ parameters[kwarg] = value + + return gc.images.list(**parameters) + diff --git a/0004-adjust-egg-info-for-Fedora.patch b/0004-adjust-egg-info-for-Fedora.patch deleted file mode 100644 index 6a0e429..0000000 --- a/0004-adjust-egg-info-for-Fedora.patch +++ /dev/null @@ -1,22 +0,0 @@ -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/python-glanceclient.spec b/python-glanceclient.spec index f3923a3..b9d38f6 100644 --- a/python-glanceclient.spec +++ b/python-glanceclient.spec @@ -1,25 +1,20 @@ Name: python-glanceclient -# Since folsom-2 OpenStack clients follow their own release plan -# and restarted version numbering from 0.1.1 -# https://lists.launchpad.net/openstack/msg14248.html Epoch: 1 -Version: 0.5.1 +Version: 0.8.0 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: http://tarballs.openstack.org/%{name}/%{name}-%{version}.tar.gz +Source0: https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz # -# patches_base=0.5.1 +# patches_base=0.8.0+1 # -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 +Patch0001: 0001-Report-name-resolution-errors-properly.patch +Patch0002: 0002-Replace-SchemaNotFound-with-HTTPNotFound.patch +Patch0003: 0003-Use-getattr-properly-in-legacy-shell.patch BuildArch: noarch BuildRequires: python-setuptools @@ -41,11 +36,11 @@ glanceclient module), and a command-line script (glance). Each implements %patch0001 -p1 %patch0002 -p1 %patch0003 -p1 -%patch0004 -p1 # Remove bundled egg-info rm -rf python_glanceclient.egg-info -sed -i '/setuptools-git/d' setup.py +# let RPM handle deps +sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py %build %{__python} setup.py build @@ -64,6 +59,10 @@ rm -fr %{buildroot}%{python_sitelib}/tests %{python_sitelib}/*.egg-info %changelog +* Mon Mar 11 2013 Jakub Ruzicka - +- Update to 0.8.0. +- Switch from tarballs.openstack.org to pypi sources. + * Sat Sep 15 2012 Alan Pevec 1:0.5.1-1 - Update to 0.5.1 diff --git a/sources b/sources index b9f4d69..8a33fd1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d5d2b1bce79ae32ee9d362fc7ccc0e32 python-glanceclient-0.5.1.tar.gz +cb7b84fb42d1023cd97d29d46cec7145 python-glanceclient-0.8.0.tar.gz