From 3cf5de75c19a998ffd1e264ae1380d99c833e752 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Tue, 7 Apr 2020 11:00:09 +0200 Subject: [PATCH] Fix the "image register" command (OSC 5.2.0 regression) python-openstackclient removed the usage of glanceclient between 5.1.0 and 5.2.0 (see: https://review.opendev.org/#/c/650374/). As a consequence, the openstack dataprocessing image register ... command is now broken. This fix means a few requirement bumps to align to OSC 5.2.0, even though saharaclient 3.0.0 is already released. Story: 2007501 Task: 39317 Change-Id: I377e0646303aef4984cdd6e4b6587fca9241206b --- lower-constraints.txt | 6 +++--- .../notes/fix-osc-520-regression-a92dff38f04e6a57.yaml | 6 ++++++ requirements.txt | 4 ++-- saharaclient/osc/v1/images.py | 4 ++-- saharaclient/tests/unit/osc/v1/test_images.py | 4 ++-- saharaclient/tests/unit/osc/v2/test_images.py | 4 ++-- 6 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/fix-osc-520-regression-a92dff38f04e6a57.yaml diff --git a/lower-constraints.txt b/lower-constraints.txt index 34290c96..82ad096d 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -31,10 +31,10 @@ msgpack-python==0.4.0 munch==2.1.0 netaddr==0.7.18 netifaces==0.10.4 -openstacksdk==0.11.2 +openstacksdk==0.36.0 os-client-config==1.28.0 os-service-types==1.2.0 -osc-lib==1.11.0 +osc-lib==2.0.0 oslo.config==5.2.0 oslo.context==2.19.2 oslo.i18n==3.15.3 @@ -58,7 +58,7 @@ python-glanceclient==2.8.0 python-keystoneclient==3.8.0 python-mimeparse==1.6.0 python-novaclient==9.1.0 -python-openstackclient==3.12.0 +python-openstackclient==5.2.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 diff --git a/releasenotes/notes/fix-osc-520-regression-a92dff38f04e6a57.yaml b/releasenotes/notes/fix-osc-520-regression-a92dff38f04e6a57.yaml new file mode 100644 index 00000000..a10371f9 --- /dev/null +++ b/releasenotes/notes/fix-osc-520-regression-a92dff38f04e6a57.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + A change in python-openstackclient 5.2.0 broke the image register command. + The incompatibility is now solved but the python-openstackclient + requirement has been bumped to 5.2.0. diff --git a/requirements.txt b/requirements.txt index 087b8026..89685ff6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,11 +6,11 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 Babel!=2.4.0,>=2.3.4 # BSD keystoneauth1>=3.4.0 # Apache-2.0 -osc-lib>=1.11.0 # Apache-2.0 +osc-lib>=2.0.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 -python-openstackclient>=3.12.0 # Apache-2.0 +python-openstackclient>=5.2.0 # Apache-2.0 requests>=2.14.2 # Apache-2.0 six>=1.10.0 # MIT diff --git a/saharaclient/osc/v1/images.py b/saharaclient/osc/v1/images.py index 36ce7532..0404a3db 100644 --- a/saharaclient/osc/v1/images.py +++ b/saharaclient/osc/v1/images.py @@ -149,8 +149,8 @@ class RegisterImage(command.ShowOne): client = self.app.client_manager.data_processing image_client = self.app.client_manager.image - image_id = osc_utils.find_resource( - image_client.images, parsed_args.image).id + image_id = image_client.find_image(parsed_args.image, + ignore_missing=False).id data = client.images.update_image( image_id, user_name=parsed_args.username, diff --git a/saharaclient/tests/unit/osc/v1/test_images.py b/saharaclient/tests/unit/osc/v1/test_images.py index 457b3f00..006a0b4f 100644 --- a/saharaclient/tests/unit/osc/v1/test_images.py +++ b/saharaclient/tests/unit/osc/v1/test_images.py @@ -176,8 +176,8 @@ class TestRegisterImage(TestImages): self.image_mock.update_image.return_value = mock.Mock( image=IMAGE_INFO.copy()) self.app.client_manager.image = mock.Mock() - self.image_client = self.app.client_manager.image.images - self.image_client.get.return_value = mock.Mock(id='id') + self.image_client = self.app.client_manager.image + self.image_client.find_image.return_value = mock.Mock(id='id') # Command to test self.cmd = osc_images.RegisterImage(self.app, None) diff --git a/saharaclient/tests/unit/osc/v2/test_images.py b/saharaclient/tests/unit/osc/v2/test_images.py index 0a1669d2..4e940011 100644 --- a/saharaclient/tests/unit/osc/v2/test_images.py +++ b/saharaclient/tests/unit/osc/v2/test_images.py @@ -176,8 +176,8 @@ class TestRegisterImage(TestImages): self.image_mock.update_image.return_value = mock.Mock( image=IMAGE_INFO.copy()) self.app.client_manager.image = mock.Mock() - self.image_client = self.app.client_manager.image.images - self.image_client.get.return_value = mock.Mock(id='id') + self.image_client = self.app.client_manager.image + self.image_client.find_image.return_value = mock.Mock(id='id') # Command to test self.cmd = osc_images.RegisterImage(self.app, None)