Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-glanceclient for openSUSE:Factory checked in at 2024-09-04 13:23:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-glanceclient (Old) and /work/SRC/openSUSE:Factory/.python-glanceclient.new.10096 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-glanceclient" Wed Sep 4 13:23:37 2024 rev:41 rq:1198501 version:4.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-glanceclient/python-glanceclient.changes 2024-06-05 17:42:40.402702387 +0200 +++ /work/SRC/openSUSE:Factory/.python-glanceclient.new.10096/python-glanceclient.changes 2024-09-04 13:23:55.596015520 +0200 @@ -1,0 +2,7 @@ +Tue Sep 3 13:11:37 UTC 2024 - cloud-de...@suse.de + +- update to version 4.7.0 + - Add support for new location APIs + - Python3.12: do not use ssl.wrap_socket + +------------------------------------------------------------------- Old: ---- python-glanceclient-4.6.0.tar.gz New: ---- python-glanceclient-4.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-glanceclient.spec ++++++ --- /var/tmp/diff_new_pack.JJ9Kvp/_old 2024-09-04 13:23:57.132079795 +0200 +++ /var/tmp/diff_new_pack.JJ9Kvp/_new 2024-09-04 13:23:57.148080465 +0200 @@ -17,14 +17,14 @@ Name: python-glanceclient -Version: 4.6.0 +Version: 4.7.0 Release: 0 Epoch: 0 Summary: Python API and CLI for OpenStack Glance License: Apache-2.0 Group: Development/Languages/Python URL: https://docs.openstack.org/python-glanceclient -Source0: https://files.pythonhosted.org/packages/source/p/python-glanceclient/python-glanceclient-4.6.0.tar.gz +Source0: https://files.pythonhosted.org/packages/source/p/python-glanceclient/python-glanceclient-4.7.0.tar.gz BuildRequires: openstack-macros BuildRequires: python3-PrettyTable >= 0.7.1 BuildRequires: python3-ddt @@ -82,15 +82,15 @@ This package contains auto-generated documentation. %prep -%autosetup -p1 -n python-glanceclient-4.6.0 +%autosetup -p1 -n python-glanceclient-4.7.0 %py_req_cleanup %build %py3_build # generate html docs -PBR_VERSION=4.6.0 %sphinx_build -b html doc/source doc/build/html -PBR_VERSION=4.6.0 %sphinx_build -b man doc/source doc/build/man +PBR_VERSION=4.7.0 %sphinx_build -b html doc/source doc/build/html +PBR_VERSION=4.7.0 %sphinx_build -b man doc/source doc/build/man # remove the sphinx-build leftovers rm -rf doc/build/html/.{doctrees,buildinfo} rm -rf doc/build/man/.{doctrees,buildinfo} ++++++ python-glanceclient-4.6.0.tar.gz -> python-glanceclient-4.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/ChangeLog new/python-glanceclient-4.7.0/ChangeLog --- old/python-glanceclient-4.6.0/ChangeLog 2024-05-16 14:57:25.000000000 +0200 +++ new/python-glanceclient-4.7.0/ChangeLog 2024-08-22 10:15:15.000000000 +0200 @@ -1,6 +1,12 @@ CHANGES ======= +4.7.0 +----- + +* Add support for new location APIs +* Python3.12: do not use ssl.wrap\_socket + 4.6.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/PKG-INFO new/python-glanceclient-4.7.0/PKG-INFO --- old/python-glanceclient-4.6.0/PKG-INFO 2024-05-16 14:57:25.964713000 +0200 +++ new/python-glanceclient-4.7.0/PKG-INFO 2024-08-22 10:15:15.331920600 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: python-glanceclient -Version: 4.6.0 +Version: 4.7.0 Summary: OpenStack Image API Client Library Home-page: https://docs.openstack.org/python-glanceclient/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/tests/unit/test_ssl.py new/python-glanceclient-4.7.0/glanceclient/tests/unit/test_ssl.py --- old/python-glanceclient-4.6.0/glanceclient/tests/unit/test_ssl.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/tests/unit/test_ssl.py 2024-08-22 10:14:43.000000000 +0200 @@ -45,12 +45,11 @@ cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt') cacert = os.path.join(TEST_VAR_DIR, 'ca.crt') (_sock, addr) = socketserver.TCPServer.get_request(self) - sock = ssl.wrap_socket(_sock, - certfile=cert_file, - keyfile=key_file, - ca_certs=cacert, - server_side=True, - cert_reqs=ssl.CERT_REQUIRED) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(cacert) + context.load_cert_chain(cert_file, key_file) + sock = context.wrap_socket(_sock, server_side=True) return sock, addr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/base.py new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/base.py --- old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/base.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/base.py 2024-08-22 10:14:43.000000000 +0200 @@ -117,6 +117,15 @@ resp = self.controller.image_import(*args, **kwargs) self._assertRequestId(resp) + def add_image_location(self, *args): + resp = self.controller.add_image_location(*args) + self._assertRequestId(resp) + + def get_image_locations(self, *args): + resource = self.controller.get_image_locations(*args) + self._assertRequestId(resource) + return resource + class BaseResourceTypeController(BaseController): def __init__(self, api, schema_api, controller_class): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/test_images.py new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/test_images.py --- old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/test_images.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/test_images.py 2024-08-22 10:14:43.000000000 +0200 @@ -688,6 +688,18 @@ ]}, ), }, + '/v2/images/3a4560a1-e585-443e-9b39-553b46ec92d1/locations': { + 'POST': ({}, '') + }, + '/v2/images/a2b83adc-888e-11e3-8872-78acc0b951d8/locations': { + 'GET': ( + {}, + [{'url': 'http://foo.com/', + 'metadata': {'store': 'cheap'}}, + {'url': 'http://bar.com/', + 'metadata': {'store': 'fast'}}], '' + ), + }, } schema_fixtures = { @@ -1503,3 +1515,60 @@ self.controller.update_location, image_id, **new_loc) self.assertIn(err_str, str(err)) + + def test_add_image_location(self): + location_url = 'http://spam.com/' + image_id = '3a4560a1-e585-443e-9b39-553b46ec92d1' + expect = [ + ('POST', + '/v2/images/%s/locations' % (image_id), + {}, + [('url', location_url), ('validation_data', {})]), + ('GET', '/v2/images/%s' % (image_id), {}, None)] + with mock.patch.object(common_utils, + 'has_version') as mock_has_version: + mock_has_version.return_value = True + self.controller.add_image_location(image_id, location_url, {}) + self.assertEqual(expect, self.api.calls) + + def test_add_image_location_with_validation_data(self): + location_url = 'http://spam.com/' + image_id = '3a4560a1-e585-443e-9b39-553b46ec92d1' + expect = [ + ('POST', + '/v2/images/%s/locations' % (image_id), + {}, + [('url', location_url), ('validation_data', + {'os_hash_algo': 'sha512'})]), + ('GET', '/v2/images/%s' % (image_id), {}, None)] + with mock.patch.object(common_utils, + 'has_version') as mock_has_version: + mock_has_version.return_value = True + self.controller.add_image_location(image_id, location_url, + {'os_hash_algo': 'sha512'}) + self.assertEqual(expect, self.api.calls) + + def test_add_image_location_not_supported(self): + with mock.patch.object(common_utils, + 'has_version') as mock_has_version: + mock_has_version.return_value = False + self.assertRaises(exc.HTTPNotImplemented, + self.controller.add_image_location, + '3a4560a1-e585-443e-9b39-553b46ec92d1', + 'http://spam.com/') + + def test_get_image_locations(self): + image_id = 'a2b83adc-888e-11e3-8872-78acc0b951d8' + with mock.patch.object(common_utils, + 'has_version') as mock_has_version: + mock_has_version.return_value = True + locations = self.controller.get_image_locations(image_id) + self.assertEqual(2, len(locations)) + + def test_get_image_location_not_supported(self): + with mock.patch.object(common_utils, + 'has_version') as mock_has_version: + mock_has_version.return_value = False + self.assertRaises(exc.HTTPNotImplemented, + self.controller.get_image_locations, + '3a4560a1-e585-443e-9b39-553b46ec92d1') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/test_shell_v2.py new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/test_shell_v2.py --- old/python-glanceclient-4.6.0/glanceclient/tests/unit/v2/test_shell_v2.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/tests/unit/v2/test_shell_v2.py 2024-08-22 10:14:43.000000000 +0200 @@ -1989,6 +1989,68 @@ loc['metadata']) utils.print_dict.assert_called_once_with(expect_image) + def test_do_add_location(self): + gc = self.gc + url = 'http://foo.com/', + validation_data = {'os_hash_algo': 'sha512', + 'os_hash_value': 'value'} + args = {'id': 'IMG-01', + 'url': url, + 'validation_data': json.dumps(validation_data)} + with mock.patch.object(gc.images, + 'add_image_location') as mock_addloc: + expect_image = {'id': 'pass'} + mock_addloc.return_value = expect_image + + test_shell.do_add_location(self.gc, self._make_args(args)) + mock_addloc.assert_called_once_with( + 'IMG-01', url, validation_data=validation_data) + utils.print_dict.assert_called_once_with(expect_image) + + @mock.patch('glanceclient.common.utils.exit') + def test_do_add_location_with_checksum_in_validation_data(self, + mock_exit): + validation_data = {'checksum': 'value', + 'os_hash_algo': 'sha512', + 'os_hash_value': 'value'} + + args = self._make_args( + {'id': 'IMG-01', 'url': 'http://foo.com/', + 'validation_data': json.dumps(validation_data)}) + expected_msg = ('Validation Data should contain only os_hash_algo' + ' and os_hash_value. `checksum` is not allowed') + mock_exit.side_effect = self._mock_utils_exit + try: + test_shell.do_add_location(self.gc, args) + self.fail("utils.exit should have been called") + except SystemExit: + pass + + mock_exit.assert_called_once_with(expected_msg) + + @mock.patch('glanceclient.common.utils.exit') + def test_do_add_location_with_invalid_algo_in_validation_data(self, + mock_exit): + validation_data = {'os_hash_algo': 'algo', + 'os_hash_value': 'value'} + + args = self._make_args( + {'id': 'IMG-01', 'url': 'http://foo.com/', + 'validation_data': json.dumps(validation_data)}) + allowed_hash_algo = ['sha512', 'sha256', 'sha1', 'md5'] + expected_msg = ('os_hash_algo: `%s` is incorrect, ' + 'allowed hashing algorithms: %s' % + (validation_data['os_hash_algo'], + allowed_hash_algo)) + mock_exit.side_effect = self._mock_utils_exit + try: + test_shell.do_add_location(self.gc, args) + self.fail("utils.exit should have been called") + except SystemExit: + pass + + mock_exit.assert_called_once_with(expected_msg) + def test_image_upload(self): args = self._make_args( {'id': 'IMG-01', 'file': 'test', 'size': 1024, 'progress': False}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/v2/images.py new/python-glanceclient-4.7.0/glanceclient/v2/images.py --- old/python-glanceclient-4.6.0/glanceclient/v2/images.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/v2/images.py 2024-08-22 10:14:43.000000000 +0200 @@ -560,3 +560,33 @@ req_id_hdr = {'x-openstack-request-id': response.request_ids[0]} return self._get(image_id, req_id_hdr) + + def add_image_location(self, image_id, location_url, validation_data={}): + """Add a new location to an image. + + :param image_id: ID of image to which the location is to be added. + :param location_url: URL of the location to add. + :param validation_data: Validation data for the image. + """ + if not utils.has_version(self.http_client, 'v2.17'): + raise exc.HTTPNotImplemented( + 'This operation is not supported by Glance.') + + url = '/v2/images/%s/locations' % image_id + data = {'url': location_url, + 'validation_data': validation_data} + resp, body = self.http_client.post(url, data=data) + return self._get(image_id) + + @utils.add_req_id_to_object() + def get_image_locations(self, image_id): + """Fetch list of locations associated to the Image. + + :param image_id: ID of image to which the location is to be fetched. + """ + if not utils.has_version(self.http_client, 'v2.17'): + raise exc.HTTPNotImplemented( + 'This operation is not supported by Glance.') + url = '/v2/images/%s/locations' % (image_id) + resp, locations = self.http_client.get(url) + return locations, resp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/glanceclient/v2/shell.py new/python-glanceclient-4.7.0/glanceclient/v2/shell.py --- old/python-glanceclient-4.6.0/glanceclient/v2/shell.py 2024-05-16 14:57:02.000000000 +0200 +++ new/python-glanceclient-4.7.0/glanceclient/v2/shell.py 2024-08-22 10:14:43.000000000 +0200 @@ -1012,6 +1012,43 @@ utils.print_dict(image) +@utils.arg('--url', metavar='<URL>', required=True, + help=_('URL of location to add.')) +@utils.arg('--validation-data', metavar='<STRING>', default='{}', + help=_('Validation data containing os_hash_algo and os_hash_value ' + 'only associated to the image. Must be a valid JSON object ' + '(default: %(default)s)')) +@utils.arg('id', metavar='<IMAGE_ID>', + help=_('ID of image whose location is to be added.')) +def do_add_location(gc, args): + """Add location to an image which is in `queued` state only. """ + try: + invalid_val_data = None + validation_data = json.loads(args.validation_data) + accepted_values = ['os_hash_algo', 'os_hash_value'] + invalid_val_data = list(set(validation_data.keys()).difference( + accepted_values)) + if invalid_val_data: + utils.exit('Validation Data should contain only os_hash_algo ' + 'and os_hash_value. `%s` is not allowed' % + (*invalid_val_data,)) + + allowed_hash_algo = ['sha512', 'sha256', 'sha1', 'md5'] + if validation_data and \ + validation_data['os_hash_algo'] not in allowed_hash_algo: + raise utils.exit('os_hash_algo: `%s` is incorrect, ' + 'allowed hashing algorithms: %s' % + (validation_data['os_hash_algo'], + allowed_hash_algo)) + + except ValueError: + utils.exit('validation-data is not a valid JSON object.') + else: + image = gc.images.add_image_location(args.id, args.url, + validation_data=validation_data) + utils.print_image(image) + + # Metadata - catalog NAMESPACE_SCHEMA = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/python_glanceclient.egg-info/PKG-INFO new/python-glanceclient-4.7.0/python_glanceclient.egg-info/PKG-INFO --- old/python-glanceclient-4.6.0/python_glanceclient.egg-info/PKG-INFO 2024-05-16 14:57:25.000000000 +0200 +++ new/python-glanceclient-4.7.0/python_glanceclient.egg-info/PKG-INFO 2024-08-22 10:15:15.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: python-glanceclient -Version: 4.6.0 +Version: 4.7.0 Summary: OpenStack Image API Client Library Home-page: https://docs.openstack.org/python-glanceclient/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/python_glanceclient.egg-info/SOURCES.txt new/python-glanceclient-4.7.0/python_glanceclient.egg-info/SOURCES.txt --- old/python-glanceclient-4.6.0/python_glanceclient.egg-info/SOURCES.txt 2024-05-16 14:57:25.000000000 +0200 +++ new/python-glanceclient-4.7.0/python_glanceclient.egg-info/SOURCES.txt 2024-08-22 10:15:15.000000000 +0200 @@ -126,6 +126,7 @@ releasenotes/notes/4.6.0_releasenotes-99ed8ea49481ee01.yaml releasenotes/notes/add-member-get-command-11c15e0a94ecd39a.yaml releasenotes/notes/add-support-for-glance-download-import-method-10525254db3e8e7a.yaml +releasenotes/notes/add_new_locations_apis_support-1ceb47178d384d58.yaml releasenotes/notes/boolean-properties-strict-checking-bdd624b5da81e723.yaml releasenotes/notes/bp-use-keystoneauth-e12f300e58577b13.yaml releasenotes/notes/check-for-md5-59db8fd67870b214.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/python_glanceclient.egg-info/pbr.json new/python-glanceclient-4.7.0/python_glanceclient.egg-info/pbr.json --- old/python-glanceclient-4.6.0/python_glanceclient.egg-info/pbr.json 2024-05-16 14:57:25.000000000 +0200 +++ new/python-glanceclient-4.7.0/python_glanceclient.egg-info/pbr.json 2024-08-22 10:15:15.000000000 +0200 @@ -1 +1 @@ -{"git_version": "59331d5", "is_release": true} \ No newline at end of file +{"git_version": "4439db2", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-glanceclient-4.6.0/releasenotes/notes/add_new_locations_apis_support-1ceb47178d384d58.yaml new/python-glanceclient-4.7.0/releasenotes/notes/add_new_locations_apis_support-1ceb47178d384d58.yaml --- old/python-glanceclient-4.6.0/releasenotes/notes/add_new_locations_apis_support-1ceb47178d384d58.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/python-glanceclient-4.7.0/releasenotes/notes/add_new_locations_apis_support-1ceb47178d384d58.yaml 2024-08-22 10:14:43.000000000 +0200 @@ -0,0 +1,23 @@ +--- +features: + - | + Add support for the new Glance ``Locations`` APIs + + - Add client support for newly added API, + ``POST /v2/images/{image_id}/locations`` in Glance. + New add location operation is allowed for service to service + interaction, end users only when `http` store is enabled in + deployment and images which are in ``queued`` state only. + This api replaces the image-update (old location-add) mechanism + for consumers like cinder and nova to address `OSSN-0090`_ and + `OSSN-0065`_. This client change adds support of new shell command + ``add-location`` and new client method ``add_image_location``. + - Add support for newly added API, + ``GET /v2/images/{image_id}/locations`` in Glance to fetch the + locations associated to an image. This change adds new client method + ``get_image_locations`` since this new get locations api is meant for + service user only hence it is not exposed to the end user as a shell + command. + + .. _OSSN-0090: https://wiki.openstack.org/wiki/OSSN/OSSN-0090 + .. _OSSN-0065: https://wiki.openstack.org/wiki/OSSN/OSSN-0065