From ed78978b5f01a33040d31f5b670ee6526e77f41f Mon Sep 17 00:00:00 2001 From: chris meyers Date: Fri, 8 Feb 2019 12:26:11 -0500 Subject: [PATCH] do not observe queries when constructing them * While parsing host_filter in the smart inventory code it was triggering sql queries. This changset avoids executing the query that is being constructed. --- awx/main/utils/filters.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/main/utils/filters.py b/awx/main/utils/filters.py index 8cda6f5c28..7cb3b58bb4 100644 --- a/awx/main/utils/filters.py +++ b/awx/main/utils/filters.py @@ -297,7 +297,11 @@ class SmartFilter(object): self.result = None i = 2 while i < len(t[0]): - if not self.result: + ''' + Do NOT observe self.result. It will cause the sql query to be executed. + We do not want that. We only want to build the query. + ''' + if isinstance(self.result, type(None)): self.result = t[0][0].result right = t[0][i].result self.result = self.execute_logic(self.result, right)