Error: variable 'kw' referenced before assignment

Bug #1311742 reported by Arati Mahimane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Solum
Fix Released
Medium
Arati Mahimane
WSME
Fix Released
Undecided
Arati Mahimane

Bug Description

When wsme receives a request with a payload containing some unknown fields it results in a Client side Unknown argument error.
If funcdef.ignore_extra_args is set to true, it results in the following error:

        UnboundLocalError: local variable 'kw' referenced before assignment

The error comes from https://github.com/stackforge/wsme/blob/master/wsme/rest/args.py#L236

Code snippet:
    try:
        kw = dataformat.parse(
            body, datatypes, bodyarg=funcdef.body_type is not None
        )
    except UnknownArgument:
        if not funcdef.ignore_extra_args:
            raise

    return (), kw

Solution:

This can be fixed by initializing the kw variable.

Changed in wsme:
assignee: nobody → Arati Mahimane (arati-mahimane)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to wsme (master)

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

Changed in wsme:
status: New → In Progress
description: updated
Adrian Otto (aotto)
Changed in solum:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Arati Mahimane (arati-mahimane)
tags: added: wsme-bug-1311742
tags: added: git-trigger-wsme-bug
removed: wsme-bug-1311742
Adrian Otto (aotto)
Changed in solum:
status: Triaged → In Progress
Adrian Otto (aotto)
tags: added: errors
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to wsme (master)

Reviewed: https://review.openstack.org/89883
Committed: https://git.openstack.org/cgit/stackforge/wsme/commit/?id=1a918b5bba6c61510846796e90128d4e72f6aeca
Submitter: Jenkins
Branch: master

commit 1a918b5bba6c61510846796e90128d4e72f6aeca
Author: arati.mahimane <email address hidden>
Date: Wed Apr 23 10:39:34 2014 -0500

    Fix error: variable 'kw' referenced before assignment

    Change-Id: Ife95d74bf645687dc4595b16434c88ee874c2f95
    Closes-bug: #1311742

Changed in wsme:
status: In Progress → Fix Committed
Changed in solum:
status: In Progress → Fix Committed
Adrian Otto (aotto)
Changed in solum:
status: Fix Committed → Fix Released
Changed in wsme:
milestone: none → 0.8.0
status: Fix Committed → Fix Released
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.