summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/integration/filter_plugins/filters.py
blob: 6acbb47ec06b79e9ade1bf9fc03a5030556c0f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Custom filters for use in testing
'''

class FilterModule(object):
    ''' Custom ansible filters '''

    @staticmethod
    def label_dict_to_key_value_list(label_dict):
        ''' given a dict of labels/values, return list of key: <key> value: <value> pairs'''

        label_list = []
        for key in label_dict:
            label_list.append({'key': key, 'value': label_dict[key]})

        return label_list

    def filters(self):
        ''' returns a mapping of filters to methods '''
        return {
            "label_dict_to_key_value_list": self.label_dict_to_key_value_list,
        }