summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/config/lookup_plugins/types.py
blob: d3092296870c0f240003bb208a9b8c4eebcf44b1 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# (c) 2021 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)

__metaclass__ = type

DOCUMENTATION = """
    name: types
    author: Ansible Core Team
    version_added: histerical
    short_description: returns what you gave it
    description:
      - this is mostly a noop
    options:
        _terms:
            description: stuff to pass through
        valid:
            description: does nothihng, just for testing values
            type: list
            ini:
                - section: list_values
                  key: valid
            env:
                - name: ANSIBLE_TYPES_VALID
            vars:
                - name: ansible_types_valid
        mustunquote:
            description: does nothihng, just for testing values
            type: list
            ini:
                - section: list_values
                  key: mustunquote
            env:
                - name: ANSIBLE_TYPES_MUSTUNQUOTE
            vars:
                - name: ansible_types_mustunquote
        notvalid:
            description: does nothihng, just for testing values
            type: list
            ini:
                - section: list_values
                  key: notvalid
            env:
                - name: ANSIBLE_TYPES_NOTVALID
            vars:
                - name: ansible_types_notvalid
        totallynotvalid:
            description: does nothihng, just for testing values
            type: list
            ini:
                - section: list_values
                  key: totallynotvalid
            env:
                - name: ANSIBLE_TYPES_TOTALLYNOTVALID
            vars:
                - name: ansible_types_totallynotvalid
"""

EXAMPLES = """
- name: like some other plugins, this is mostly useless
  debug: msg={{ q('types', [1,2,3])}}
"""

RETURN = """
  _list:
    description: basically the same as you fed in
    type: list
    elements: raw
"""

from ansible.plugins.lookup import LookupBase


class LookupModule(LookupBase):

    def run(self, terms, variables=None, **kwargs):

        self.set_options(var_options=variables, direct=kwargs)

        return terms