diff --git a/doc/source/dev/plugin/planner-plugin.rst b/doc/source/dev/plugin/planner-plugin.rst index 3f539ee1c..de2e7b111 100644 --- a/doc/source/dev/plugin/planner-plugin.rst +++ b/doc/source/dev/plugin/planner-plugin.rst @@ -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 diff --git a/watcher/tests/db/test_purge.py b/watcher/tests/db/test_purge.py index d69968257..5a0dde7e4 100644 --- a/watcher/tests/db/test_purge.py +++ b/watcher/tests/db/test_purge.py @@ -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 diff --git a/watcher/tests/decision_engine/model/test_mapping.py b/watcher/tests/decision_engine/model/test_mapping.py index 36e771226..e1e4cdbde 100644 --- a/watcher/tests/decision_engine/model/test_mapping.py +++ b/watcher/tests/decision_engine/model/test_mapping.py @@ -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_ diff --git a/watcher_tempest_plugin/tests/api/admin/test_audit_template.py b/watcher_tempest_plugin/tests/api/admin/test_audit_template.py index cb1514554..6f585af59 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_audit_template.py +++ b/watcher_tempest_plugin/tests/api/admin/test_audit_template.py @@ -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)