Glance RPC client fails when the returned value is a integer

Bug #1204668 reported by John Bresnahan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Flavio Percoco

Bug Description

I am trying to add a new method to the database module that returns an int. When I access that method via RPC I get the following error:

  File "/home/jbresnah/Dev/OpenStack/glance/glance/common/rpc.py", line 269, in method_proxy
    return self.do_request(item, **kw)
  File "/home/jbresnah/Dev/OpenStack/glance/glance/common/rpc.py", line 247, in do_request
    if self.raise_exc and (content and '_error' in content):
TypeError: argument of type 'int' is not iterable

This happens because line:

https://github.com/openstack/glance/blob/master/glance/common/rpc.py#L245

assumes that the result is a string and it searches for a substring to determine error.

Changed in glance:
assignee: nobody → Flavio Percoco (flaper87)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.openstack.org/38606
Committed: http://github.com/openstack/glance/commit/c2683ac373de78d271b7065a55720a464aae561d
Submitter: Jenkins
Branch: master

commit c2683ac373de78d271b7065a55720a464aae561d
Author: Flaper Fesp <email address hidden>
Date: Thu Jul 25 11:13:33 2013 +0200

    Verify if the RPC result is an instance of dict

    The RPC client is currently assuming that all values returned from the
    API are iterable. Since errors are always returned as dicts, this patch
    verifies whether the returned value is an instance of dict before
    checking for the existence of the _error key.

    Fixes bug: #1204668

    Change-Id: Ie953d7dd2d327334789d66f689a30ce5e36afba9

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-3 → 2013.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.