diff options
author | Thomas Wiest <twiest@redhat.com> | 2014-10-02 13:09:21 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@redhat.com> | 2014-10-02 13:11:15 -0400 |
commit | 4935246c7b412a87e9a1100e398705a868095db3 (patch) | |
tree | 39f0d05198efccecccc128ca2a8790d914534b98 | |
parent | 50b543ac15983a4d84d2f1843ee9e5a6bd28da4e (diff) | |
download | openshift-4935246c7b412a87e9a1100e398705a868095db3.tar.gz openshift-4935246c7b412a87e9a1100e398705a868095db3.tar.bz2 openshift-4935246c7b412a87e9a1100e398705a868095db3.tar.xz openshift-4935246c7b412a87e9a1100e398705a868095db3.zip |
Added oo_len filter
-rw-r--r-- | filter_plugins/oo_filters.py | 7 |
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 } |