Merge "Use uuidutils of oslo.utils"
This commit is contained in:
@@ -14,10 +14,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import uuid
|
|
||||||
|
|
||||||
from keystoneauth1 import session
|
from keystoneauth1 import session
|
||||||
import mock
|
import mock
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
import novaclient.api_versions
|
import novaclient.api_versions
|
||||||
import novaclient.client
|
import novaclient.client
|
||||||
@@ -72,7 +72,7 @@ class SessionClientTest(utils.TestCase):
|
|||||||
self.assertEqual(0, len(cs.get_timings()))
|
self.assertEqual(0, len(cs.get_timings()))
|
||||||
|
|
||||||
def test_global_id(self):
|
def test_global_id(self):
|
||||||
global_id = "req-%s" % uuid.uuid4()
|
global_id = "req-%s" % uuidutils.generate_uuid()
|
||||||
self.requests_mock.get('http://no.where')
|
self.requests_mock.get('http://no.where')
|
||||||
|
|
||||||
client = novaclient.client.SessionClient(session=session.Session(),
|
client = novaclient.client.SessionClient(session=session.Session(),
|
||||||
|
@@ -16,10 +16,10 @@ import os
|
|||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import prettytable
|
import prettytable
|
||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse
|
from six.moves.urllib import parse
|
||||||
@@ -255,9 +255,9 @@ def find_resource(manager, name_or_id, wrap_exception=True, **find_args):
|
|||||||
if six.PY3:
|
if six.PY3:
|
||||||
tmp_id = tmp_id.decode()
|
tmp_id = tmp_id.decode()
|
||||||
|
|
||||||
uuid.UUID(tmp_id)
|
if uuidutils.is_uuid_like(tmp_id):
|
||||||
return manager.get(tmp_id)
|
return manager.get(tmp_id)
|
||||||
except (TypeError, ValueError, exceptions.NotFound):
|
except (TypeError, exceptions.NotFound):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# then try to get entity as name
|
# then try to get entity as name
|
||||||
|
Reference in New Issue
Block a user