summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-11-30 12:32:50 +0000
committerStephen Finucane <sfinucan@redhat.com>2022-11-30 12:35:17 +0000
commit85254fbeb4bc30a0e947de9557a87ff1e7e2a3b2 (patch)
tree177a3911e2c35f13e72b17b2483b998a8d8ae4c7
parent6cd72f61826a1af79fe9244240d95283203cd03b (diff)
downloadpython-openstackclient-85254fbeb4bc30a0e947de9557a87ff1e7e2a3b2.tar.gz
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 <sfinucan@redhat.com>
-rw-r--r--openstackclient/image/v2/image.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 039f1d2d..737cf324 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