From 85197a92d3e986610099a86d7789e0dc93ae005a Mon Sep 17 00:00:00 2001 From: wangqi Date: Tue, 3 Apr 2018 02:25:42 +0000 Subject: [PATCH] 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 --- vmware_nsxlib/v3/client_cert.py | 6 +++--- vmware_nsxlib/v3/policy_resources.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vmware_nsxlib/v3/client_cert.py b/vmware_nsxlib/v3/client_cert.py index 7727fb3a..2a9f1df8 100644 --- a/vmware_nsxlib/v3/client_cert.py +++ b/vmware_nsxlib/v3/client_cert.py @@ -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) diff --git a/vmware_nsxlib/v3/policy_resources.py b/vmware_nsxlib/v3/policy_resources.py index 441efd3e..410c5886 100644 --- a/vmware_nsxlib/v3/policy_resources.py +++ b/vmware_nsxlib/v3/policy_resources.py @@ -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):