Lookups: use Ansible's config manager whenever possible (#5440)

* Start using Ansible's config manager to handle options.

* Docs improvements.

* Fix documentation, make options actual lookup options.

* The cyberarkpassword lookup does too strange things.

* The onepassword lookups are converted in #4728, let's not interfere.

* Improve docs.

* Skip shelvefile as well.

* Convert lmdb_kv.

* Convert and fix credstash.

* Convert manifold.

* Drop chef_databag.

* Convert dig.

* Update examples.

* Forgot the most important part.

* Fix lmdb_kv docs.

* Python 2.6 compatibility.

* Convert AnsibleUnicode to str.

* Load lookup with lookup loader.

* Fix environment handling and error message checking.

* Improve docs formatting.
This commit is contained in:
Felix Fontein 2022-11-01 21:58:46 +01:00 committed by GitHub
commit e718bd8445
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 161 additions and 91 deletions

View file

@ -14,23 +14,24 @@ DOCUMENTATION = '''
- Read keys from Python shelve file.
options:
_terms:
description: sets of key value pairs of parameters
description: Sets of key value pairs of parameters.
key:
description: key to query
description: Key to query.
required: true
file:
description: path to shelve file
description: Path to shelve file.
required: true
'''
EXAMPLES = """
- name: retrieve a string value corresponding to a key inside a Python shelve file
ansible.builtin.debug: msg="{{ lookup('community.general.shelvefile', 'file=path_to_some_shelve_file.db key=key_to_retrieve') }}
- name: Retrieve a string value corresponding to a key inside a Python shelve file
ansible.builtin.debug:
msg: "{{ lookup('community.general.shelvefile', 'file=path_to_some_shelve_file.db key=key_to_retrieve') }}"
"""
RETURN = """
_list:
description: value(s) of key(s) in shelve file(s)
description: Value(s) of key(s) in shelve file(s).
type: list
elements: str
"""
@ -53,7 +54,6 @@ class LookupModule(LookupBase):
return res
def run(self, terms, variables=None, **kwargs):
if not isinstance(terms, list):
terms = [terms]