TypeError in database launch error handle

Bug #1306815 reported by Matthew D. Wood
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Matthew D. Wood

Bug Description

openstack_dashboard.dashboards.project.databases.workflows.create_instance in populate_flavor_choices
TypeError: 'NoneType' object is not iterable

If there's an exception in openstack_dashboard/dashboards/project/databases/workflows/create_instance.py SetInstanceDetailsAction.flavors, the follow-on method will have a TypeError.

[code]
    @memoized.memoized_method
    def flavors(self, request):
        try:
            return api.trove.flavor_list(request)
        except Exception:
            LOG.exception("Exception while obtaining flavors list")
            self._flavors = []

    def populate_flavor_choices(self, request, context):
        flavor_list = [(f.id, "%s" % f.name) for f in self.flavors(request)]
        return sorted(flavor_list)
[code]

if self.flavors has an error, it will eventually return a None.

There's 2 options here:
A) return an empty list
B) redirect to another page

I have to believe that returning an empty list will be more confusing than a redirect, so I'd like to handle this with exceptions.handle.

Tags: trove
Changed in horizon:
assignee: nobody → Matthew D. Wood (woodm1979)
Changed in horizon:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/88413

Changed in horizon:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/88413
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=8e40c6ce915339553ce04fdb1590a8bac873c15a
Submitter: Jenkins
Branch: master

commit 8e40c6ce915339553ce04fdb1590a8bac873c15a
Author: woodm1979 <email address hidden>
Date: Thu Apr 17 13:35:40 2014 -0600

    Fixed TypeError in database launch error handle

    openstack_dashboard.dashboards.project.databases.workflows.create_instance
    in populate_flavor_choices

    TypeError: 'NoneType' object is not iterable

    If there's an exception in
    openstack_dashboard/dashboards/project/databases/workflows/create_instance.py
    SetInstanceDetailsAction.flavors, the follow-on method will have a
    TypeError.

    [code]
        @memoized.memoized_method
        def flavors(self, request):
            try:
                return api.trove.flavor_list(request)
            except Exception:
                LOG.exception("Exception while obtaining flavors list")
                self._flavors = []

        def populate_flavor_choices(self, request, context):
            flavor_list = [(f.id, "%s" % f.name) for f in self.flavors(request)]
            return sorted(flavor_list)
    [code]

    if self.flavors has an error, it will eventually return a None.

    There's 2 options here:
    A) return an empty list
    B) redirect to another page

    I have to believe that returning an empty list will be more confusing
    than a redirect, so I'd like to handle this with exceptions.handle.

    Change-Id: I9aff36875c26958ab8ef1f99828ed6113216c3c3
    Closes-Bug: 1306815

Changed in horizon:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: none → juno-3
tags: added: trove
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.