← Back to team overview

openstack team mailing list archive

Dashboard/horizon PRODUCTION bug

 

JPEG image

diff -u /tmp/workflows.py "/usr/lib/python2.7/dist-packages/horizon/dashboards/nova/instances/workflows.py"
--- /tmp/workflows.py   2013-01-10 14:24:31.874187212 +1100
+++ /usr/lib/python2.7/dist-packages/horizon/dashboards/nova/instances/workflows.py     2013-01-10 14:30:01.531892135 +1100
@@ -23,7 +23,9 @@
 from django.utils.text import normalize_newlines
 from django.utils.translation import ugettext as _

-from horizon import api
+from horizon.api import glanceclient
+from horizon.api import nova
+from horizon.api import quantum
 from horizon import exceptions
 from horizon import forms
 from horizon import workflows
@@ -115,8 +117,8 @@
     def populate_volume_id_choices(self, request, context):
         volume_options = [("", _("Select Volume"))]
         try:
-            volumes = [v for v in api.nova.volume_list(self.request)
-                       if v.status == api.VOLUME_STATE_AVAILABLE]
+            volumes = [v for v in nova.volume_list(self.request)
+                       if v.status == nova.VOLUME_STATE_AVAILABLE]
             volume_options.extend([self._get_volume_display_name(vol)
                                    for vol in volumes])
         except:
@@ -127,9 +129,9 @@
     def populate_volume_snapshot_id_choices(self, request, context):
         volume_options = [("", _("Select Volume Snapshot"))]
         try:
-            snapshots = api.nova.volume_snapshot_list(self.request)
+            snapshots = nova.volume_snapshot_list(self.request)
             snapshots = [s for s in snapshots
-                         if s.status == api.VOLUME_STATE_AVAILABLE]
+                         if s.status == nova.VOLUME_STATE_AVAILABLE]
             volume_options.extend([self._get_volume_display_name(snap)
                                    for snap in snapshots])
         except:
@@ -220,7 +222,7 @@
             public = {"is_public": True,
                       "status": "active"}
             try:
-                public_images, _more = api.glance.image_list_detailed(request,
+                public_images, _more = glanceclient.image_list_detailed(request,
                                                            filters=public)
             except:
                 public_images = []
@@ -236,7 +238,7 @@
             owner = {"property-owner_id": project_id,
                      "status": "active"}
             try:
-                owned_images, _more = api.glance.image_list_detailed(request,
+                owned_images, _more = glanceclient.image_list_detailed(request,
                                                           filters=owner)
             except:
                 exceptions.handle(request,
@@ -281,7 +283,7 @@

     def populate_flavor_choices(self, request, context):
         try:
-            flavors = api.nova.flavor_list(request)
+            flavors = nova.flavor_list(request)
             flavor_list = [(flavor.id, "%s" % flavor.name)
                            for flavor in flavors]
         except:
@@ -293,10 +295,10 @@
     def get_help_text(self):
         extra = {}
         try:
-            extra['usages'] = api.nova.tenant_quota_usages(self.request)
+            extra['usages'] = nova.tenant_quota_usages(self.request)
             extra['usages_json'] = jsonutils.dumps(extra['usages'])
             flavors = jsonutils.dumps([f._info for f in
-                                       api.nova.flavor_list(self.request)])
+                                       nova.flavor_list(self.request)])
             extra['flavors'] = flavors
         except:
             exceptions.handle(self.request,
@@ -350,7 +352,7 @@

     def populate_keypair_choices(self, request, context):
         try:
-            keypairs = api.nova.keypair_list(request)
+            keypairs = nova.keypair_list(request)
             keypair_list = [(kp.name, kp.name) for kp in keypairs]
         except:
             keypair_list = []
@@ -364,7 +366,7 @@

     def populate_groups_choices(self, request, context):
         try:
-            groups = api.nova.security_group_list(request)
+            groups = nova.security_group_list(request)
             security_group_list = [(sg.name, sg.name) for sg in groups]
         except:
             exceptions.handle(request,
@@ -422,7 +424,7 @@
     def populate_network_choices(self, request, context):
         try:
             tenant_id = self.request.user.tenant_id
-            networks = api.quantum.network_list_for_tenant(request, tenant_id)
+            networks = quantum.network_list_for_tenant(request, tenant_id)
             for n in networks:
                 n.set_id_as_name_if_empty()
             network_list = [(network.id, network.name) for network in networks]
@@ -494,7 +496,7 @@
             nics = None

         try:
-            api.nova.server_create(request,
+            nova.server_create(request,
                                    context['name'],
                                    context['source_id'],
                                    context['flavor'],

Follow ups