mirror of https://github.com/ansible/ansible.git
config lookup, fixes and tests (#84398)
* Integration tests for lookup_config Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>pull/82263/head
parent
6d21e28c73
commit
b154e38e54
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- config - various fixes to config lookup plugin (https://github.com/ansible/ansible/pull/84398).
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
# (c) 2021 Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
|
DOCUMENTATION = """
|
||||||
|
name: bogus
|
||||||
|
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
|
||||||
|
test_list:
|
||||||
|
description: does nothihng, just for testing values
|
||||||
|
type: string
|
||||||
|
required: True
|
||||||
|
"""
|
||||||
|
|
||||||
|
EXAMPLES = """
|
||||||
|
"""
|
||||||
|
|
||||||
|
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)
|
||||||
|
self.get_option('test_list')
|
||||||
|
|
||||||
|
return terms
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
ANSIBLE_ROLES_PATH=../ ANSIBLE_LOOKUP_PLUGINS=. ansible-playbook runme.yml "$@"
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
- hosts: localhost
|
||||||
|
gather_facts: no
|
||||||
|
roles:
|
||||||
|
- { role: lookup_config }
|
||||||
Loading…
Reference in New Issue