genericQuery filters objects without runtime data first. We need to filter the objects again, this time with runtime data.
This fixes issue 1100. Signed-off-by: BSRK Aditya <[email protected]> --- src/Ganeti/Query/Query.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Ganeti/Query/Query.hs b/src/Ganeti/Query/Query.hs index 135d660..9979858 100644 --- a/src/Ganeti/Query/Query.hs +++ b/src/Ganeti/Query/Query.hs @@ -227,13 +227,15 @@ genericQuery fieldsMap collector nameFn configFn getFn cfg _ -> mapM (getFn cfg) wanted -- Run the first pass of the filter, without a runtime context; this will -- limit the objects that we'll contact for exports - fobjects <- toError $ filterM (\n -> evaluateFilter cfg Nothing n cfilter) - objects - -- Gather the runtime data - runtimes <- case collector of + fobjects <- toError $ + filterM (\n -> evaluateQueryFilter cfg Nothing n cfilter) objects + -- Gather the runtime data and filter the results again, + -- based on the gathered data + runtimes <- (case collector of CollectorSimple collFn -> lift $ collFn live' cfg fobjects - CollectorFieldAware collFn -> lift $ collFn live' cfg fields fobjects - -- Filter the results again, based on the gathered data + CollectorFieldAware collFn -> lift $ collFn live' cfg fields fobjects) >>= + (toError . filterM (\(obj, runtime) -> + evaluateQueryFilter cfg (Just runtime) obj cfilter)) let fdata = map (\(obj, runtime) -> map (execGetter cfg runtime obj) fgetters) runtimes -- 1.7.10.4
