Merge "Remove redundant `where` for forbidden traits"

This commit is contained in:
Zuul 2018-10-11 16:23:35 +00:00 committed by Gerrit Code Review
commit 94c8d253ec
1 changed files with 4 additions and 1 deletions

View File

@ -1447,7 +1447,10 @@ class ResourceProviderList(base.ObjectListBase, base.VersionedObject):
return []
if rp_ids:
query = query.where(rp.c.id.in_(rp_ids))
if forbidden_rp_ids:
# forbidden providers, if found, are mutually exclusive with matching
# providers above, so we only need to include this clause if we didn't
# use the positive filter above.
elif forbidden_rp_ids:
query = query.where(~rp.c.id.in_(forbidden_rp_ids))
if not resources: