Replace uuid.uuid4() with uuidutils.generate_uuid()

Since oslo.utils provide the ability to generate the uuid string,
and some others use oslo.utils[0] too. For consistency, this ps
replaces uuid.uuid4() with uuidutils.generate_uuid().

Change-Id: I0513d43e62ecec19a8df6fd62b5e8d2e1e2f4803
This commit is contained in:
wangqi 2018-04-03 02:25:42 +00:00
parent 23ca97efa5
commit 85197a92d3
2 changed files with 5 additions and 5 deletions

View File

@ -15,10 +15,10 @@
import datetime
from time import time
import uuid
from OpenSSL import crypto
from oslo_log import log
from oslo_utils import uuidutils
from vmware_nsxlib._i18n import _
from vmware_nsxlib.v3 import exceptions as nsxlib_exceptions
@ -156,7 +156,7 @@ class ClientCertificateManager(object):
subject)
# register on backend
self._register_cert(cert, node_id or uuid.uuid4())
self._register_cert(cert, node_id or uuidutils.generate_uuid())
# save in storage
cert_pem = crypto.dump_certificate(crypto.FILETYPE_PEM, cert)
@ -224,7 +224,7 @@ class ClientCertificateManager(object):
cert = self._get_cert_from_file(filename)
# register on backend
self._register_cert(cert, node_id or uuid.uuid4())
self._register_cert(cert, node_id or uuidutils.generate_uuid())
cert_pem = crypto.dump_certificate(crypto.FILETYPE_PEM, cert)
self._storage_driver.store_cert(self._identity, cert_pem, None)

View File

@ -15,9 +15,9 @@
#
import abc
import uuid
from oslo_log import log as logging
from oslo_utils import uuidutils
import six
from vmware_nsxlib._i18n import _
@ -62,7 +62,7 @@ class NsxPolicyResourceBase(object):
def _init_obj_uuid(obj_uuid):
if not obj_uuid:
# generate a random id
obj_uuid = str(uuid.uuid4())
obj_uuid = str(uuidutils.generate_uuid())
return obj_uuid
def _canonize_name(self, name):