summaryrefslogtreecommitdiff
path: root/roles/installer/debian/fetch/filter_plugins/main.py
blob: 298e7efd24c729f68df29576d2d0e8ee8daf444d (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
26
27
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

from ansible import errors


def di_images_path(data):
    try:
        if data[0] != 'ubuntu':
            return 'images'

        if data[1] in ['xenial', 'bionic']:
            return 'images'

        return 'legacy-images'
    except Exception as e:
        raise errors.AnsibleFilterError("mountpoint_exists(): %s" % str(e))


class FilterModule(object):

    filter_map = {
        'di_images_path': di_images_path,
    }

    def filters(self):
        return self.filter_map