summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Toscano <ltoscano@redhat.com>2020-04-07 11:00:09 +0200
committerLuigi Toscano <ltoscano@redhat.com>2020-04-07 11:00:09 +0200
commit3cf5de75c19a998ffd1e264ae1380d99c833e752 (patch)
tree6bc829f8e26389453b95b4c12624ebc2f634ab33
parent82ecc50fbe247ba72b0b3cfb73ff83d89390cd9d (diff)
downloadpython-saharaclient-3cf5de75c19a998ffd1e264ae1380d99c833e752.tar.gz
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
-rw-r--r--lower-constraints.txt6
-rw-r--r--releasenotes/notes/fix-osc-520-regression-a92dff38f04e6a57.yaml6
-rw-r--r--requirements.txt4
-rw-r--r--saharaclient/osc/v1/images.py4
-rw-r--r--saharaclient/tests/unit/osc/v1/test_images.py4
-rw-r--r--saharaclient/tests/unit/osc/v2/test_images.py4
6 files changed, 17 insertions, 11 deletions
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 34290c9..82ad096 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 0000000..a10371f
--- /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 087b802..89685ff 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 36ce753..0404a3d 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 457b3f0..006a0b4 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 0a1669d..4e94001 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)