#!/usr/bin/env python3 import os def filterEnabled(inputdict): output = [] for i in inputdict.keys(): if inputdict.get(i): output.append(i) return output def vmpath2hostpath(inputfiles, mountpoint): output = [] for line in inputfiles: line = os.path.normpath(line) if line.startswith('/'): disk = '*' output.append(os.path.join(mountpoint, disk, line[1:])) else: output.append(line) return output class FilterModule(object): def filters(self): return { 'vmpath2hostpath': vmpath2hostpath, 'filterEnabled': filterEnabled, }