Debian Codegraph @

test/integration/targets/config/lookup_plugins/broken.py

raw
1 # -*- coding: utf-8 -*-
2 # Copyright (c) 2025, Felix Fontein <[email protected]>, The Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5 from __future__ import annotations
6
7
8 DOCUMENTATION = r"""
9 name: broken
10 short_description: Test input precedence
11 author: Felix Fontein (@felixfontein)
12 description:
13 - Test input precedence.
14 options:
15 _terms:
16 description:
17 - Ignored.
18 type: list
19 elements: str
20 required: true
21 some_option:
22 description:
23 - The interesting part.
24 type: str
25 default: default value
26 env:
27 - name: PLAYGROUND_TEST_1
28 - name: PLAYGROUND_TEST_2
29 vars:
30 - name: playground_test_1
31 - name: playground_test_2
32 ini:
33 - key: playground_test_1
34 section: playground
35 - key: playground_test_2
36 section: playground
37 """
38
39 EXAMPLES = r"""#"""
40
41 RETURN = r"""
42 _list:
43 description:
44 - The value of O(some_option).
45 type: list
46 elements: str
47 """
48
49 from ansible.plugins.lookup import LookupBase
50
51
52 class LookupModule(LookupBase):
53 def run(self, terms, variables=None, **kwargs):
54 """Generate list."""
55 self.set_options(var_options=variables, direct=kwargs)
56
57 return [self.get_option("some_option"), *self.get_option_and_origin("some_option")]