diff options
| author | Dmitriy Rabotyagov <drabotyagov@vexxhost.com> | 2020-03-12 20:35:49 +0200 |
|---|---|---|
| committer | Monty Taylor <mordred@inaugust.com> | 2020-03-24 13:13:12 +0000 |
| commit | 042be7c7fe89f5a1a190af90d5980205d995941b (patch) | |
| tree | 687470e3f29253db0a065a1cfea7bdfde19cc79d /openstackclient/image | |
| parent | 768a64aac5bd14f56c142faeec1793aac91947cb (diff) | |
| download | python-openstackclient-042be7c7fe89f5a1a190af90d5980205d995941b.tar.gz | |
Don't look up project by id if given id
There is a much deeper and systemic issue going on here, but let's
start with fixing the immediate issue which is that adding a project
to an image fails trying to look up project information even if the
user passes the project id by id.
_is_uuid_like from sdk isn't perfect, but it'll be good enough
for this.
Change-Id: I541416d737b961c56aa2f584c172528632fd5537
Diffstat (limited to 'openstackclient/image')
| -rw-r--r-- | openstackclient/image/v2/image.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 412a16cc..53ce560d 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -21,6 +21,7 @@ import logging import os import sys +import openstack.cloud._utils from openstack.image import image_signer from osc_lib.api import utils as api_utils from osc_lib.cli import format_columns @@ -158,9 +159,13 @@ class AddProjectToImage(command.ShowOne): image_client = self.app.client_manager.image identity_client = self.app.client_manager.identity - project_id = common.find_project(identity_client, - parsed_args.project, - parsed_args.project_domain).id + if openstack.cloud._utils._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 image = image_client.find_image(parsed_args.image, ignore_missing=False) |
