summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2015-06-26 16:57:28 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2015-06-29 14:48:48 -0400
commitcde074730ed8278673498157008651d192c8236a (patch)
tree4ee6293daf334a825e9fcf1caa71ce42189a621d /filter_plugins
parentdf51a7dddad9e6f93a24c3ec07a07a661e6e168a (diff)
downloadopenshift-cde074730ed8278673498157008651d192c8236a.tar.gz
openshift-cde074730ed8278673498157008651d192c8236a.tar.bz2
openshift-cde074730ed8278673498157008651d192c8236a.tar.xz
openshift-cde074730ed8278673498157008651d192c8236a.zip
The manage_node commands should only run on the first master
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index b7248efaa..0f3f4fa9e 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -52,8 +52,9 @@ class FilterModule(object):
@staticmethod
def oo_collect(data, attribute=None, filters=None):
''' This takes a list of dict and collects all attributes specified into a
- list If filter is specified then we will include all items that match
- _ALL_ of filters.
+ list. If filter is specified then we will include all items that
+ match _ALL_ of filters. If a dict entry is missing the key in a
+ filter it will be excluded from the match.
Ex: data = [ {'a':1, 'b':5, 'z': 'z'}, # True, return
{'a':2, 'z': 'z'}, # True, return
{'a':3, 'z': 'z'}, # True, return
@@ -74,7 +75,7 @@ class FilterModule(object):
raise errors.AnsibleFilterError("|fialed expects filter to be a"
" dict")
retval = [FilterModule.get_attr(d, attribute) for d in data if (
- all([d[key] == filters[key] for key in filters]))]
+ all([d.get(key, None) == filters[key] for key in filters]))]
else:
retval = [FilterModule.get_attr(d, attribute) for d in data]