diff options
author | Thomas Wiest <twiest@gmail.com> | 2014-10-02 13:11:47 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@gmail.com> | 2014-10-02 13:11:47 -0400 |
commit | 5cb37d422a9aa62fef793c155a12368745cd6c87 (patch) | |
tree | 39f0d05198efccecccc128ca2a8790d914534b98 | |
parent | 50b543ac15983a4d84d2f1843ee9e5a6bd28da4e (diff) | |
parent | 4935246c7b412a87e9a1100e398705a868095db3 (diff) | |
download | openshift-5cb37d422a9aa62fef793c155a12368745cd6c87.tar.gz openshift-5cb37d422a9aa62fef793c155a12368745cd6c87.tar.bz2 openshift-5cb37d422a9aa62fef793c155a12368745cd6c87.tar.xz openshift-5cb37d422a9aa62fef793c155a12368745cd6c87.zip |
Merge pull request #7 from twiest/quick
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 } |