← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1177842] Re: SQLAlchemy Query.first() can't raise the NoResultFound exception

 

** Changed in: quantum
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to quantum.
https://bugs.launchpad.net/bugs/1177842

Title:
  SQLAlchemy Query.first() can't raise the NoResultFound exception

Status in OpenStack Quantum (virtual network service):
  Fix Released

Bug description:
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/quantum/+bug/1177842/+subscriptions