Fix the host_get_all_by_queries() method

Current logic misjudges that a ComputeHost object does not have an
attribute which is specified in a query if the value of the attribute
is 0 or False. This patch fixes the logic.

Change-Id: I9143f11dd022fe3f683c0f3a2a87c3f5562461d8
This commit is contained in:
Hiroaki Kobayashi 2017-11-15 11:22:04 +09:00
parent 0770f6acbe
commit 091fed5b58

View File

@ -633,7 +633,7 @@ def host_get_all_by_queries(queries):
raise db_exc.BlazarDBInvalidFilter(query_filter=query)
column = getattr(models.ComputeHost, key, None)
if column:
if column is not None:
if op == 'in':
filt = column.in_(value.split(','))
else: