From c98d7edef877b3386634842c66a68a8b75e232b3 Mon Sep 17 00:00:00 2001 From: Chang Bo Guo Date: Thu, 21 Nov 2013 03:06:02 -0800 Subject: [PATCH] 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 --- openstack-common.conf | 1 - oslo/messaging/notify/notifier.py | 4 +- oslo/messaging/openstack/common/uuidutils.py | 39 -------------------- 3 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 oslo/messaging/openstack/common/uuidutils.py diff --git a/openstack-common.conf b/openstack-common.conf index 729779c66..a9223df45 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -9,7 +9,6 @@ module=jsonutils module=network_utils module=sslutils module=timeutils -module=uuidutils # The base module to hold the copy of openstack.common base=oslo.messaging diff --git a/oslo/messaging/notify/notifier.py b/oslo/messaging/notify/notifier.py index 4cc025973..d9a646569 100644 --- a/oslo/messaging/notify/notifier.py +++ b/oslo/messaging/notify/notifier.py @@ -17,13 +17,13 @@ import abc import logging +import uuid from oslo.config import cfg import six from stevedore import named from oslo.messaging.openstack.common import timeutils -from oslo.messaging.openstack.common import uuidutils from oslo.messaging import serializer as msg_serializer _notifier_opts = [ @@ -152,7 +152,7 @@ class Notifier(object): payload = self._serializer.serialize_entity(ctxt, payload) 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, event_type=event_type, priority=priority, diff --git a/oslo/messaging/openstack/common/uuidutils.py b/oslo/messaging/openstack/common/uuidutils.py deleted file mode 100644 index 7608acb94..000000000 --- a/oslo/messaging/openstack/common/uuidutils.py +++ /dev/null @@ -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