Add filter module base, prepare adding filters (#553)

* Improve string handling.

* Cleanup tests.

* Add filter module mock.
This commit is contained in:
Felix Fontein
2022-12-30 20:44:13 +01:00
committed by GitHub
parent 5d24d04adf
commit 80f7b084c0
9 changed files with 36 additions and 22 deletions

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2022 Felix Fontein <felix@fontein.de>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# NOTE: THIS IS ONLY FOR FILTER PLUGINS!
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.errors import AnsibleFilterError
class FilterModuleMock(object):
def __init__(self, params):
self.check_mode = True
self.params = params
self._diff = False
def fail_json(self, msg, **kwargs):
raise AnsibleFilterError(msg)