diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-04-01 12:42:03 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-04-01 12:42:03 -0400 |
commit | 035b498f37cdb5947d3d7c9254c23a20ca77eddd (patch) | |
tree | 624568e79f9c8e6bc875daef981c2cf86297ef9b /filter_plugins | |
parent | 5f0b024fedc826722306c159bbf91a3c74ec3b4e (diff) | |
download | openshift-035b498f37cdb5947d3d7c9254c23a20ca77eddd.tar.gz openshift-035b498f37cdb5947d3d7c9254c23a20ca77eddd.tar.bz2 openshift-035b498f37cdb5947d3d7c9254c23a20ca77eddd.tar.xz openshift-035b498f37cdb5947d3d7c9254c23a20ca77eddd.zip |
Adding the zabbix module along with a generic playbook to fetch current problem triggers. Also added oo_flatten to filters for arrays of arrays.
Diffstat (limited to 'filter_plugins')
-rw-r--r-- | filter_plugins/oo_filters.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index caf1fd1f0..1cf02218c 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -34,6 +34,15 @@ def get_attr(data, attribute=None): return ptr +def oo_flatten(data): + ''' This filter plugin will flatten a list of lists + ''' + if not issubclass(type(data), list): + raise errors.AnsibleFilterError("|failed expects to flatten a List") + + return [ item for sublist in data for item in sublist ] + + def oo_collect(data, attribute=None, filters={}): ''' 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. @@ -97,6 +106,7 @@ class FilterModule (object): return { "oo_select_keys": oo_select_keys, "oo_collect": oo_collect, + "oo_flatten": oo_flatten, "oo_len": oo_len, "oo_pdb": oo_pdb, "oo_prepend_strings_in_list": oo_prepend_strings_in_list |