summaryrefslogtreecommitdiffstats
path: root/filter_plugins/oo_filters.py
diff options
context:
space:
mode:
Diffstat (limited to 'filter_plugins/oo_filters.py')
-rw-r--r--filter_plugins/oo_filters.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 0c34cfc3e..77abfb2a4 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -9,6 +9,12 @@ def oo_pdb(arg):
pdb.set_trace()
return arg
+def oo_len(arg):
+ ''' This returns the size of the argument
+ Ex: "{{ hostvars | oo_size }}"
+ '''
+ return len(arg)
+
def get_attr(data, attribute=None):
''' This looks up dictionary attributes of the form a.b.c and returns the value.
Ex: data = {'a': {'b': {'c': 5}}}
@@ -65,5 +71,6 @@ class FilterModule (object):
return {
"oo_select_keys": oo_select_keys,
"oo_collect": oo_collect,
+ "oo_len": oo_len,
"oo_pdb": oo_pdb
}