Decouple from Oslo uuidutils module

uuidutils module will be deprecated in Icehouse, So need replace it.
This patch uses str(uuid.uuid4()) instead of method generate_uuid.

Closes-Bug: #1253497
Change-Id: I35815544429c489096b4db3fa79a649f4cd9459f
This commit is contained in:
Chang Bo Guo 2013-11-21 03:06:02 -08:00
parent 7e1fddb217
commit c98d7edef8
3 changed files with 2 additions and 42 deletions

View File

@ -9,7 +9,6 @@ module=jsonutils
module=network_utils module=network_utils
module=sslutils module=sslutils
module=timeutils module=timeutils
module=uuidutils
# The base module to hold the copy of openstack.common # The base module to hold the copy of openstack.common
base=oslo.messaging base=oslo.messaging

View File

@ -17,13 +17,13 @@
import abc import abc
import logging import logging
import uuid
from oslo.config import cfg from oslo.config import cfg
import six import six
from stevedore import named from stevedore import named
from oslo.messaging.openstack.common import timeutils from oslo.messaging.openstack.common import timeutils
from oslo.messaging.openstack.common import uuidutils
from oslo.messaging import serializer as msg_serializer from oslo.messaging import serializer as msg_serializer
_notifier_opts = [ _notifier_opts = [
@ -152,7 +152,7 @@ class Notifier(object):
payload = self._serializer.serialize_entity(ctxt, payload) payload = self._serializer.serialize_entity(ctxt, payload)
ctxt = self._serializer.serialize_context(ctxt) ctxt = self._serializer.serialize_context(ctxt)
msg = dict(message_id=uuidutils.generate_uuid(), msg = dict(message_id=str(uuid.uuid4()),
publisher_id=publisher_id or self.publisher_id, publisher_id=publisher_id or self.publisher_id,
event_type=event_type, event_type=event_type,
priority=priority, priority=priority,

View File

@ -1,39 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Intel Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
UUID related utilities and helper functions.
"""
import uuid
def generate_uuid():
return str(uuid.uuid4())
def is_uuid_like(val):
"""Returns validation of a value as a UUID.
For our purposes, a UUID is a canonical form string:
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
"""
try:
return str(uuid.UUID(val)) == val
except (TypeError, ValueError, AttributeError):
return False