From 0803fd2112a6ebb4de7e5f95a00b9bef3e1d86f2 Mon Sep 17 00:00:00 2001 From: Piotr Sipika Date: Thu, 22 Jan 2026 16:24:18 -0500 Subject: [PATCH] Make --all-stores behave the same as in glanceclient. In order for python-openstackclient to support image imports to mutliple stores at the same time an update is needed to the --all-stores argument used by the client whereby the argument is explicitly set to contain a boolean value. This change makes the argument do what it's supposed to and do it in a way consistent with the API contract exposed by Glance. Amend tests to support the change in type of the --all-stores option. Change-Id: If5a72ca3ca68656555b5eb478e104d43f419c77e Closes-Bug: 2138903 Signed-off-by: Piotr Sipika Co-authored-by: Stephen Finucane --- openstackclient/image/v2/image.py | 1 + openstackclient/tests/unit/image/v2/test_image.py | 10 +++++----- releasenotes/notes/bug-2138903-f75c7348f22db195.yaml | 5 +++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/bug-2138903-f75c7348f22db195.yaml diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index cbb6d874de..e8d040e14c 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -1719,6 +1719,7 @@ class ImportImage(command.ShowOne): ) stores_group.add_argument( '--all-stores', + action='store_true', help=_( "Make image available to all stores " "(either '--store' or '--all-stores' required with the " diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py index e6de9f2ebd..c9a273ba97 100644 --- a/openstackclient/tests/unit/image/v2/test_image.py +++ b/openstackclient/tests/unit/image/v2/test_image.py @@ -2085,7 +2085,7 @@ class TestImageImport(TestImage): remote_image_id=None, remote_service_interface=None, stores=None, - all_stores=None, + all_stores=False, all_stores_must_succeed=False, ) @@ -2115,7 +2115,7 @@ class TestImageImport(TestImage): remote_image_id=None, remote_service_interface=None, stores=None, - all_stores=None, + all_stores=False, all_stores_must_succeed=False, ) @@ -2253,7 +2253,7 @@ class TestImageImport(TestImage): remote_image_id=None, remote_service_interface=None, stores=['fast'], - all_stores=None, + all_stores=False, all_stores_must_succeed=False, ) @@ -2285,7 +2285,7 @@ class TestImageImport(TestImage): remote_image_id=None, remote_service_interface=None, stores=['fast'], - all_stores=None, + all_stores=False, all_stores_must_succeed=True, ) @@ -2320,7 +2320,7 @@ class TestImageImport(TestImage): remote_image_id='remote-image-id', remote_service_interface='private', stores=None, - all_stores=None, + all_stores=False, all_stores_must_succeed=False, ) diff --git a/releasenotes/notes/bug-2138903-f75c7348f22db195.yaml b/releasenotes/notes/bug-2138903-f75c7348f22db195.yaml new file mode 100644 index 0000000000..249242146d --- /dev/null +++ b/releasenotes/notes/bug-2138903-f75c7348f22db195.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The ``--all-stores`` of the ``image import`` command is now correctly + treated as a boolean flag.