Stop using private _is_uuid_like method

currently this double-private method of a dependency library
is used in several places (openstack.cloud._utils._is_uuid_like)

openstacksdk deliberatly chose not to depend on oslo.utils to keep
dependenies to the minimum, so it just copied several methods from it,
including the is_uuid_like.

python-openstackclient however already depends on oslo.utils, so
using the public method from oslo.utils should be preferred
and more stable.

Change-Id: I578ffa36ffb00c9d47ee12a149313201973edd32
This commit is contained in:
Pavlo Shchelokovskyy
2022-04-20 17:36:36 +03:00
parent dabaec5a7b
commit afc5f997c8
2 changed files with 5 additions and 5 deletions

View File

@@ -19,10 +19,10 @@ import logging
import iso8601 import iso8601
from novaclient import api_versions from novaclient import api_versions
import openstack.cloud._utils
from osc_lib.command import command from osc_lib.command import command
from osc_lib import exceptions from osc_lib import exceptions
from osc_lib import utils from osc_lib import utils
from oslo_utils import uuidutils
from openstackclient.i18n import _ from openstackclient.i18n import _
@@ -152,7 +152,7 @@ class ListServerEvent(command.Lister):
# If we fail to find the resource, it is possible the server is # If we fail to find the resource, it is possible the server is
# deleted. Try once more using the <server> arg directly if it is a # deleted. Try once more using the <server> arg directly if it is a
# UUID. # UUID.
if openstack.cloud._utils._is_uuid_like(parsed_args.server): if uuidutils.is_uuid_like(parsed_args.server):
server_id = parsed_args.server server_id = parsed_args.server
else: else:
raise raise
@@ -224,7 +224,7 @@ class ShowServerEvent(command.ShowOne):
# If we fail to find the resource, it is possible the server is # If we fail to find the resource, it is possible the server is
# deleted. Try once more using the <server> arg directly if it is a # deleted. Try once more using the <server> arg directly if it is a
# UUID. # UUID.
if openstack.cloud._utils._is_uuid_like(parsed_args.server): if uuidutils.is_uuid_like(parsed_args.server):
server_id = parsed_args.server server_id = parsed_args.server
else: else:
raise raise

View File

@@ -21,7 +21,6 @@ import logging
import os import os
import sys import sys
import openstack.cloud._utils
from openstack.image import image_signer from openstack.image import image_signer
from osc_lib.api import utils as api_utils from osc_lib.api import utils as api_utils
from osc_lib.cli import format_columns from osc_lib.cli import format_columns
@@ -29,6 +28,7 @@ from osc_lib.cli import parseractions
from osc_lib.command import command from osc_lib.command import command
from osc_lib import exceptions from osc_lib import exceptions
from osc_lib import utils from osc_lib import utils
from oslo_utils import uuidutils
from openstackclient.common import progressbar from openstackclient.common import progressbar
from openstackclient.i18n import _ from openstackclient.i18n import _
@@ -159,7 +159,7 @@ class AddProjectToImage(command.ShowOne):
image_client = self.app.client_manager.image image_client = self.app.client_manager.image
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if openstack.cloud._utils._is_uuid_like(parsed_args.project): if uuidutils.is_uuid_like(parsed_args.project):
project_id = parsed_args.project project_id = parsed_args.project
else: else:
project_id = common.find_project( project_id = common.find_project(