From 035b498f37cdb5947d3d7c9254c23a20ca77eddd Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 1 Apr 2015 12:42:03 -0400 Subject: Adding the zabbix module along with a generic playbook to fetch current problem triggers. Also added oo_flatten to filters for arrays of arrays. --- filter_plugins/oo_filters.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'filter_plugins') 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 -- cgit v1.2.1