From a42bb36d5f6f12d2470f6072feaa3a47da0e5463 Mon Sep 17 00:00:00 2001 From: iswarya_vakati Date: Wed, 5 Jul 2017 16:01:35 +0530 Subject: [PATCH] Replaces uuid.uuid4 with uuidutils.generate_uuid() Change-Id: I751aa0e819faaf0a5cd07741fa812ab15dec967d --- karbor_dashboard/checkpoints/views.py | 6 +++--- karbor_dashboard/protectionplans/views.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/karbor_dashboard/checkpoints/views.py b/karbor_dashboard/checkpoints/views.py index 133af62..9315d39 100644 --- a/karbor_dashboard/checkpoints/views.py +++ b/karbor_dashboard/checkpoints/views.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import uuid from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy @@ -31,6 +30,7 @@ from karbor_dashboard.checkpoints import forms from karbor_dashboard.checkpoints import tables from karbor_dashboard.checkpoints import utils from karborclient.v1 import protectables +from oslo_utils import uuidutils class IndexView(horizon_tables.DataTableView): @@ -232,7 +232,7 @@ class CheckpointsRestoreView(horizon_forms.ModalFormView): resource["id"] = graphnode.value.id resource["type"] = graphnode.value.type resource["name"] = graphnode.value.name - resource["showid"] = str(uuid.uuid4()) + resource["showid"] = uuidutils.generate_uuid() resource["showparentid"] = showparentid result = protectables.Instances(self, resource) results.append(result) @@ -300,7 +300,7 @@ class DetailView(horizon_tables.DataTableView): resource["id"] = graphnode.value.id resource["type"] = graphnode.value.type resource["name"] = graphnode.value.name - resource["showid"] = str(uuid.uuid4()) + resource["showid"] = uuidutils.generate_uuid() resource["showparentid"] = showparentid result = protectables.Instances(self, resource) results.append(result) diff --git a/karbor_dashboard/protectionplans/views.py b/karbor_dashboard/protectionplans/views.py index 554428d..6b898cb 100644 --- a/karbor_dashboard/protectionplans/views.py +++ b/karbor_dashboard/protectionplans/views.py @@ -13,7 +13,6 @@ # under the License. import json -import uuid from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy @@ -29,6 +28,7 @@ from karbor_dashboard.api import karbor as karborclient from karbor_dashboard.protectionplans import forms from karbor_dashboard.protectionplans import tables from karborclient.v1 import protectables +from oslo_utils import uuidutils class IndexView(horizon_tables.DataTableView): @@ -122,7 +122,7 @@ class CreateView(horizon_forms.ModalFormView): resource["id"] = instance.id resource["type"] = instance.type resource["name"] = instance.name - resource["showid"] = str(uuid.uuid4()) + resource["showid"] = uuidutils.generate_uuid() resource["showparentid"] = showparentid result = protectables.Instances(self, resource) results.append(result) @@ -174,7 +174,7 @@ class UpdateView(horizon_forms.ModalFormView): resource["id"] = instance.id resource["type"] = instance.type resource["name"] = instance.name - resource["showid"] = str(uuid.uuid4()) + resource["showid"] = uuidutils.generate_uuid() resource["showparentid"] = showparentid result = protectables.Instances(self, resource) results.append(result) @@ -294,7 +294,7 @@ class DetailView(horizon_views.HorizonTemplateView): try: result = [] for instance in instances: - instance["showid"] = str(uuid.uuid4()) + instance["showid"] = uuidutils.generate_uuid() result.append(protectables.Instances(self, instance)) detail_instance = karborclient.protectable_get_instance( self.request, @@ -302,7 +302,7 @@ class DetailView(horizon_views.HorizonTemplateView): instance["id"].strip()) if detail_instance.dependent_resources: for dependent in detail_instance.dependent_resources: - dependent["showid"] = str(uuid.uuid4()) + dependent["showid"] = uuidutils.generate_uuid() dependent["showparentid"] = instance["showid"] result.append( protectables.Instances(self, dependent))