Incorrect logic in api.v2.base.Controller._is_visible

Bug #1181718 reported by Eugene Nikanorov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Eugene Nikanorov

Bug Description

The following code:

       try:
            attr = (attributes.RESOURCE_ATTRIBUTE_MAP
                    [self._collection].get(attr_name))
            if attr and attr.get('enforce_policy'):
                authz_check = policy.check_if_exists(
                    context, action, data)
        except KeyError:
            # The extension was not configured for adding its resources
            # to the global resource attribute map. Policy check should
            # not be performed
            LOG.debug(_("The resource %(resource)s was not found in the "
                        "RESOURCE_ATTRIBUTE_MAP; unable to perform authZ "
                        "check for attribute %(attr)s"),
                      {'resource': self._collection,
                       'attr': attr_name})

Will generate " UnboundLocalError: local variable 'attr' referenced before assignment " in case 'attr = ' throws KeyError

Tags: api
tags: added: api
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

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

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

Reviewed: https://review.openstack.org/29704
Committed: http://github.com/openstack/quantum/commit/60d478e518d63290f110177a31e8f5ffc1c54681
Submitter: Jenkins
Branch: master

commit 60d478e518d63290f110177a31e8f5ffc1c54681
Author: Eugene Nikanorov <email address hidden>
Date: Sun May 19 18:01:33 2013 +0400

    Fix logic in api.v2.base.Controller._is_visible

    Fix accessing yet unassigned local variable in case
    exception is thrown.

    fixes bug 1181718

    Change-Id: Iea8f0cc252c1d2105cc696d917a347aa10b206a8

Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
milestone: none → havana-1
tags: added: grizzly-backport-potential
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
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.