Replaces uuid.uuid4 with uuidutils.generate_uuid()

Change-Id: I38740842402841ae446603faacbbe969854f2396
Closes-Bug: #1082248
This commit is contained in:
qinchunhua 2016-11-17 19:27:54 +08:00
parent 3ebe8ab70f
commit 876f3adb22
4 changed files with 13 additions and 13 deletions

View File

@ -39,7 +39,7 @@ Here is an example showing how you can write a planner plugin called
# Filepath = third-party/third_party/dummy.py
# Import path = third_party.dummy
import uuid
from oslo_utils import uuidutils
from watcher.decision_engine.planner import base
@ -47,7 +47,7 @@ Here is an example showing how you can write a planner plugin called
def _create_action_plan(self, context, audit_id):
action_plan_dict = {
'uuid': uuid.uuid4(),
'uuid': uuidutils.generate_uuid(),
'audit_id': audit_id,
'first_action_id': None,
'state': objects.action_plan.State.RECOMMENDED

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
from oslo_utils import uuidutils
import freezegun
import mock
@ -73,7 +73,7 @@ class TestPurgeCommand(base.DbTestCase):
seed += 1
def generate_unique_name(self, prefix):
return "%s%s" % (prefix, uuid.uuid4())
return "%s%s" % (prefix, uuidutils.generate_uuid())
def _data_setup(self):
# All the 1's are soft_deleted and are expired

View File

@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import uuid
from oslo_utils import uuidutils
from watcher.decision_engine.model import element
from watcher.tests import base
@ -95,7 +95,7 @@ class TestMapping(base.TestCase):
instances = model.get_all_instances()
keys = list(instances.keys())
instance0 = instances[keys[0]]
uuid_ = "{0}".format(uuid.uuid4())
uuid_ = uuidutils.generate_uuid()
node = element.ComputeNode(id=1)
node.uuid = uuid_

View File

@ -16,7 +16,7 @@
from __future__ import unicode_literals
import uuid
from oslo_utils import uuidutils
from tempest.lib import exceptions
from tempest import test
@ -33,7 +33,7 @@ class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest):
_, goal = self.client.show_goal(goal_name)
params = {
'name': 'my at name %s' % uuid.uuid4(),
'name': 'my at name %s' % uuidutils.generate_uuid(),
'description': 'my at description',
'goal': goal['uuid']}
expected_data = {
@ -56,7 +56,7 @@ class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest):
_, goal = self.client.show_goal(goal_name)
# Use a unicode string for testing:
params = {
'name': 'my at name %s' % uuid.uuid4(),
'name': 'my at name %s' % uuidutils.generate_uuid(),
'description': 'my àt déscrïptïôn',
'goal': goal['uuid']}
@ -158,13 +158,13 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
_, new_goal = self.client.show_goal("server_consolidation")
_, new_strategy = self.client.show_strategy("basic")
params = {'name': 'my at name %s' % uuid.uuid4(),
params = {'name': 'my at name %s' % uuidutils.generate_uuid(),
'description': 'my at description',
'goal': self.goal['uuid']}
_, body = self.create_audit_template(**params)
new_name = 'my at new name %s' % uuid.uuid4()
new_name = 'my at new name %s' % uuidutils.generate_uuid()
new_description = 'my new at description'
patch = [{'path': '/name',
@ -191,7 +191,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
@test.attr(type='smoke')
def test_update_audit_template_remove(self):
description = 'my at description'
name = 'my at name %s' % uuid.uuid4()
name = 'my at name %s' % uuidutils.generate_uuid()
params = {'name': name,
'description': description,
'goal': self.goal['uuid']}
@ -213,7 +213,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
@test.attr(type='smoke')
def test_update_audit_template_add(self):
params = {'name': 'my at name %s' % uuid.uuid4(),
params = {'name': 'my at name %s' % uuidutils.generate_uuid(),
'goal': self.goal['uuid']}
_, body = self.create_audit_template(**params)