AttributeError in report client error path

Bug #1742311 reported by Eric Fried
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

This [1] is clearly wrong.

        elif not result:
            placement_req_id = get_placement_request_id(result)
            LOG.warning('[%(placement_req_id)s] Failed to update inventory '
                        'for resource provider %(uuid)s: %(status)i %(text)s',
                        {'placement_req_id': placement_req_id,
                         'uuid': rp_uuid,
                         'status': result.status_code,
                         'text': result.text})

It triggers if `result` evaluates to False, then tries to access result.status_code and result.text.

[1] https://github.com/openstack/nova/blob/90a92d33edaea2b7411a5fd528f3159a486e1fd0/nova/scheduler/client/report.py#L756-L763

Tags: placement
Revision history for this message
Matt Riedemann (mriedem) wrote :

This isn't clearly wrong, because the result is a requests.Response which overrides __bool__ and returns True for an OK response and False for any response status code >=400.

https://github.com/requests/requests/blob/v2.18.4/requests/models.py#L663

Changed in nova:
status: New → Invalid
Revision history for this message
Eric Fried (efried) wrote :
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.