vendordata v2 will fail on a 204 response

Bug #1669084 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann

Bug Description

https://review.openstack.org/#/c/434339/ changed the logic in the dynamic vendor data v2 handler such that any successful response is accepted and tries to load up the response body into json, which will fail in the 204 case where there is no content to load, so jsonutils.load will fail with a TypeError or ValueError for None and '' respectively.

The tests didn't cover this because they are using mock and not something that models how requests.Response overrides __bool__ / __nonzero__.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/439785
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3c1943f8d9974477d88ba94336d94db6c4346e01
Submitter: Jenkins
Branch: master

commit 3c1943f8d9974477d88ba94336d94db6c4346e01
Author: Matt Riedemann <email address hidden>
Date: Wed Mar 1 14:16:29 2017 -0500

    Check for 204 case in DynamicVendorData

    Before b9587587c2f3d6f871dec07562c16e1d82bc05e6 we were doing
    an explicit check on the response status codes, but after
    that change, we just rely on the bool override in requests.Reponse
    which is True for any repsonse code less than 400. In the 204 case
    we won't have response text, so we should handle that before trying
    to load the json repsonse text. Because TypeError and ValueError are
    handled it would just result in a warning if you got a 204, unless
    CONF.api.vendordata_dynamic_failure_fatal was True in which case
    it's a failure (as shown in the unit test update here).

    Change-Id: Iba95fd0112ae4510ef21fdb44fcb281b14567c07
    Closes-Bug: #1669084

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 16.0.0.0b1

This issue was fixed in the openstack/nova 16.0.0.0b1 development milestone.

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.