Browse Source

Replaces uuid.uuid4 with uuidutils.generate_uuid()

Change-Id: I751aa0e819faaf0a5cd07741fa812ab15dec967d
iswarya_vakati 1 year ago
parent
commit
a42bb36d5f

+ 3
- 3
karbor_dashboard/checkpoints/views.py View File

@@ -12,7 +12,6 @@
12 12
 #    License for the specific language governing permissions and limitations
13 13
 #    under the License.
14 14
 
15
-import uuid
16 15
 
17 16
 from django.core.urlresolvers import reverse
18 17
 from django.core.urlresolvers import reverse_lazy
@@ -31,6 +30,7 @@ from karbor_dashboard.checkpoints import forms
31 30
 from karbor_dashboard.checkpoints import tables
32 31
 from karbor_dashboard.checkpoints import utils
33 32
 from karborclient.v1 import protectables
33
+from oslo_utils import uuidutils
34 34
 
35 35
 
36 36
 class IndexView(horizon_tables.DataTableView):
@@ -232,7 +232,7 @@ class CheckpointsRestoreView(horizon_forms.ModalFormView):
232 232
                 resource["id"] = graphnode.value.id
233 233
                 resource["type"] = graphnode.value.type
234 234
                 resource["name"] = graphnode.value.name
235
-                resource["showid"] = str(uuid.uuid4())
235
+                resource["showid"] = uuidutils.generate_uuid()
236 236
                 resource["showparentid"] = showparentid
237 237
                 result = protectables.Instances(self, resource)
238 238
                 results.append(result)
@@ -300,7 +300,7 @@ class DetailView(horizon_tables.DataTableView):
300 300
                 resource["id"] = graphnode.value.id
301 301
                 resource["type"] = graphnode.value.type
302 302
                 resource["name"] = graphnode.value.name
303
-                resource["showid"] = str(uuid.uuid4())
303
+                resource["showid"] = uuidutils.generate_uuid()
304 304
                 resource["showparentid"] = showparentid
305 305
                 result = protectables.Instances(self, resource)
306 306
                 results.append(result)

+ 5
- 5
karbor_dashboard/protectionplans/views.py View File

@@ -13,7 +13,6 @@
13 13
 #    under the License.
14 14
 
15 15
 import json
16
-import uuid
17 16
 
18 17
 from django.core.urlresolvers import reverse
19 18
 from django.core.urlresolvers import reverse_lazy
@@ -29,6 +28,7 @@ from karbor_dashboard.api import karbor as karborclient
29 28
 from karbor_dashboard.protectionplans import forms
30 29
 from karbor_dashboard.protectionplans import tables
31 30
 from karborclient.v1 import protectables
31
+from oslo_utils import uuidutils
32 32
 
33 33
 
34 34
 class IndexView(horizon_tables.DataTableView):
@@ -122,7 +122,7 @@ class CreateView(horizon_forms.ModalFormView):
122 122
                 resource["id"] = instance.id
123 123
                 resource["type"] = instance.type
124 124
                 resource["name"] = instance.name
125
-                resource["showid"] = str(uuid.uuid4())
125
+                resource["showid"] = uuidutils.generate_uuid()
126 126
                 resource["showparentid"] = showparentid
127 127
                 result = protectables.Instances(self, resource)
128 128
                 results.append(result)
@@ -174,7 +174,7 @@ class UpdateView(horizon_forms.ModalFormView):
174 174
                 resource["id"] = instance.id
175 175
                 resource["type"] = instance.type
176 176
                 resource["name"] = instance.name
177
-                resource["showid"] = str(uuid.uuid4())
177
+                resource["showid"] = uuidutils.generate_uuid()
178 178
                 resource["showparentid"] = showparentid
179 179
                 result = protectables.Instances(self, resource)
180 180
                 results.append(result)
@@ -294,7 +294,7 @@ class DetailView(horizon_views.HorizonTemplateView):
294 294
         try:
295 295
             result = []
296 296
             for instance in instances:
297
-                instance["showid"] = str(uuid.uuid4())
297
+                instance["showid"] = uuidutils.generate_uuid()
298 298
                 result.append(protectables.Instances(self, instance))
299 299
                 detail_instance = karborclient.protectable_get_instance(
300 300
                     self.request,
@@ -302,7 +302,7 @@ class DetailView(horizon_views.HorizonTemplateView):
302 302
                     instance["id"].strip())
303 303
                 if detail_instance.dependent_resources:
304 304
                     for dependent in detail_instance.dependent_resources:
305
-                        dependent["showid"] = str(uuid.uuid4())
305
+                        dependent["showid"] = uuidutils.generate_uuid()
306 306
                         dependent["showparentid"] = instance["showid"]
307 307
                         result.append(
308 308
                             protectables.Instances(self, dependent))

Loading…
Cancel
Save