summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Hayes <gr@ham.ie>2018-02-18 16:16:16 +0000
committerGraham Hayes <gr@ham.ie>2018-05-02 17:35:07 +0000
commit3bc0c0a9b20aad21219b3bd5be7a74800bb0b67a (patch)
treec99b5769196e0513412e749e907b4e9c764619fa
parentcb60d7316c283667629355f33bf5602c4950101f (diff)
downloaddesignate-3bc0c0a9b20aad21219b3bd5be7a74800bb0b67a.tar.gz
Do not filter pools by attributes when non are provided
This change stops the AttributeFilter from filtering when no attributes were provided. This also removes the pool_id attribte from the request, as this is used in a different filter. Change-Id: If57d81e0343fa442828da7390bf20249f4791861 (cherry picked from commit c6ee02d71af602e2db768605eef6f03fe14fbd70)
-rw-r--r--designate/scheduler/filters/attribute_filter.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/designate/scheduler/filters/attribute_filter.py b/designate/scheduler/filters/attribute_filter.py
index ff3c9bf3..8751fc24 100644
--- a/designate/scheduler/filters/attribute_filter.py
+++ b/designate/scheduler/filters/attribute_filter.py
@@ -69,6 +69,17 @@ class AttributeFilter(base.Filter):
except exceptions.RelationNotLoaded:
pool_attributes = {}
+ # Remove the "pool_id" attribute, that is used in
+ # PoolIDAttributeFilter. If the item is not in the dict, it is
+ # fine, we should just continue.
+ pool_attributes.pop('pool_id', None)
+
+ if pool_attributes == {}:
+ # If we did not send any attribute to filter on, we should
+ # not filter the pools based on an empty set, as this will
+ # return no pools.
+ return True
+
# Check if the keys requested exist in this pool
if not {key for key in six.iterkeys(pool_attributes)}.issuperset(
zone_attributes):