SQLAlchemy Query.first() is used incorrectly in this code fragment of quantum/plugins/nicira/nicira_qos_db.py:
try:
with context.session.begin(subtransactions=True):
binding = query.filter_by(network_id=network_id).first()
if binding:
context.session.delete(binding)
except exc.NoResultFound:
# return since this can happen if we are updating a port that
# did not already have a queue on it. There is no need to check
# if there is one before deleting if we return here.
return
In fact, Query.first() doesn't raise the NoResultFound exception if no result is found but rather returns None.
Fix proposed to branch: master /review. openstack. org/28571
Review: https:/