Remove fm.common.utils.generate_uuid.

Replace fm-rest-api fm.common.utils.generate_uuid with
oslo_utils.uuidutils.generate_uuid.

Closes-Bug: 1859738

Depends-on: https://review.opendev.org/#/c/702347/
Change-Id: I31e1ec1c0605707697f03446b1e04eec5063c5f3
Signed-off-by: chenyan <yan.chen@intel.com>
This commit is contained in:
chenyan 2020-01-15 15:22:52 +08:00
parent 79a90ab979
commit 1b555beaa8
3 changed files with 2 additions and 12 deletions

View File

@ -21,7 +21,6 @@
#
import six
import uuid
from oslo_log import log
from oslo_concurrency import lockutils
@ -30,10 +29,6 @@ from fm.common import constants
LOG = log.getLogger(__name__)
def generate_uuid():
return str(uuid.uuid4())
def synchronized(name, external=True):
if external:
lock_path = constants.FM_LOCK_PATH

View File

@ -23,7 +23,6 @@ from sqlalchemy.orm.exc import NoResultFound
from fm.api import config
from fm.common import constants
from fm.common import exceptions
from fm.common import utils
from fm.db import api
from fm.db.sqlalchemy import models
from fm import objects
@ -182,7 +181,7 @@ class Connection(api.Connection):
def alarm_create(self, values):
if not values.get('uuid'):
values['uuid'] = utils.generate_uuid()
values['uuid'] = uuidutils.generate_uuid()
alarm = models.Alarm()
alarm.update(values)
with _session_for_write() as session:
@ -311,7 +310,7 @@ class Connection(api.Connection):
def event_log_create(self, values):
if not values.get('uuid'):
values['uuid'] = utils.generate_uuid()
values['uuid'] = uuidutils.generate_uuid()
event_log = models.EventLog()
event_log.update(values)
count = self.event_log_get_count()

View File

@ -19,10 +19,6 @@ from fm.tests import base
class FaultUtilsTestCase(base.TestCase):
def test_generate_uuid(self):
uuid = utils.generate_uuid()
self.assertTrue(isinstance(uuid, str))
def test_safe_rstrip(self):
input_int = 1
self.assertEqual(input_int, utils.safe_rstrip(input_int))