From 85254fbeb4bc30a0e947de9557a87ff1e7e2a3b2 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 30 Nov 2022 12:32:50 +0000 Subject: [PATCH] Revert "Don't look up project by id if given id" This reverts commit 042be7c7fe89f5a1a190af90d5980205d995941b. This solution worked but it was confusing. The issue that the author was seeing was presumably due to users not being able to list projects but in theory the 'openstackclient.image.common.find_project' function that was being called here should have already handle this. It transpires however that there was a bug in this and we weren't correctly handling HTTP 403 errors correctly. This bug has since been fixed in change I2ea2def607ec5be112e42d53a1e660fef0cdd69c meaning this change is no longer necessary. Remove it and simplify the code somewhat. Change-Id: I108efec2c8deda50fcb9cc84f313602bed2ac15c Signed-off-by: Stephen Finucane --- openstackclient/image/v2/image.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 039f1d2dc8..737cf324c7 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -29,7 +29,6 @@ from osc_lib.cli import parseractions from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils -from oslo_utils import uuidutils from openstackclient.common import progressbar from openstackclient.i18n import _ @@ -184,14 +183,11 @@ class AddProjectToImage(command.ShowOne): image_client = self.app.client_manager.image identity_client = self.app.client_manager.identity - if uuidutils.is_uuid_like(parsed_args.project): - project_id = parsed_args.project - else: - project_id = common.find_project( - identity_client, - parsed_args.project, - parsed_args.project_domain, - ).id + project_id = common.find_project( + identity_client, + parsed_args.project, + parsed_args.project_domain, + ).id image = image_client.find_image( parsed_args.image, ignore_missing=False