Replaces uuid.uuid4 with uuidutils.generate_uuid()

Openstack oslo_utils has a generate_uuid function for generating
uuids. We should use that function when generating uuids for
consistency.

Change-Id: I096069a0d8a963f325c8bfa9106c972acdbd82bf
This commit is contained in:
sudhir_agarwal 2017-07-24 11:45:42 +05:30
parent 07d307b5a8
commit 4605452d35
3 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,7 @@
# under the License.
import datetime
import uuid
from oslo_utils import uuidutils
from . import config
@ -31,7 +31,7 @@ class BaseDatabaseModel(object):
logger.debug("Attempting to create object class instance "
"'{}' with attributes '{}'"
.format(str(self.__class__), str(kwargs)))
self.id = uuid.uuid4().hex
self.id = uuidutils.generate_uuid(dashed=False)
self.created_at = str(datetime.datetime.now())
self.updated_at = str(datetime.datetime.now())
for k, v in kwargs.items():

View File

@ -13,7 +13,7 @@
# under the License.
import collections
import uuid
from oslo_utils import uuidutils
from functionsclient import client
from functionsclient.v1 import apps
@ -78,7 +78,7 @@ class FakeRoutes(object):
else:
route = await self.show(path, loop=loop)
return "Hello world!" if route.type == "sync" else {
"call_id": uuid.uuid4().hex
"call_id": uuidutils.generate_uuid()
}
async def update(self, route_path, loop=None, **data):

View File

@ -14,9 +14,9 @@
import os
import testtools
import uuid
from aioservice.http import service
from oslo_utils import uuidutils
from ...api.controllers import apps
from ...api.controllers import routes
@ -71,8 +71,8 @@ class FunctionalTestsBase(base.PicassoTestsBase, testtools.TestCase):
functions_client=fnclient,
)
self.project_id = str(uuid.uuid4()).replace("-", "")
self.other_project_id = str(uuid.uuid4()).replace("-", "")
self.project_id = uuidutils.generate_uuid().replace("-", "")
self.other_project_id = uuidutils.generate_uuid().replace("-", "")
self.test_client = client.ProjectBoundTestClient(
self.testapp, self.project_id)