summaryrefslogtreecommitdiff
path: root/roles/mail/postfix/relay/filter_plugins/postfix.py
blob: 673cba0bddc72e2381cdf62eed7a1a07de6c1c48 (plain) (blame)
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
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

from ansible import errors


def postfix_maps(maps, prefix=''):
    try:
        tmp = []
        for name, map in maps.items():
            tmp.append('%s:%s%s' % (map['type'], prefix, name))
        return ', '.join(tmp)
    except Exception as e:
        raise errors.AnsibleFilterError("postfix_maps(): %s" % str(e))


class FilterModule(object):

    ''' postfix helpers '''
    filter_map = {
        'postfix_maps': postfix_maps,
    }

    def filters(self):
        return self.filter_map