mirror of https://github.com/ansible/ansible.git
add fragments to return (#72635)
* ansible-doc add ability to use doc_fragments for RETURN --------- Co-authored-by: Felix Fontein <felix@fontein.de>pull/85616/head
parent
945516c209
commit
ca5871f256
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- ansible-doc adds support for RETURN documentation to support doc fragment plugins
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
|
class ModuleDocFragment(object):
|
||||||
|
|
||||||
|
# Standard documentation fragment
|
||||||
|
RETURN = r'''
|
||||||
|
y_notlast:
|
||||||
|
description: A return from fragment
|
||||||
|
type: str
|
||||||
|
returned: it depends TM
|
||||||
|
|
||||||
|
z_last:
|
||||||
|
description: A a return from fragment with merge.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
'''
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
---
|
||||||
|
module: test_docs_returns
|
||||||
|
short_description: Test module
|
||||||
|
description:
|
||||||
|
- Test module
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = '''
|
||||||
|
m_middle:
|
||||||
|
description:
|
||||||
|
- This should be in the middle.
|
||||||
|
- Has some more data
|
||||||
|
type: dict
|
||||||
|
returned: success and 1st of month
|
||||||
|
contains:
|
||||||
|
suboption:
|
||||||
|
description: A suboption.
|
||||||
|
type: str
|
||||||
|
choices: [ARF, BARN, c_without_capital_first_letter]
|
||||||
|
|
||||||
|
a_first:
|
||||||
|
description: A first result.
|
||||||
|
type: str
|
||||||
|
returned: success
|
||||||
|
|
||||||
|
z_last:
|
||||||
|
example: this is a merge
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- test_return_frag
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=dict(),
|
||||||
|
)
|
||||||
|
|
||||||
|
module.exit_json()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
> MODULE test_docs_return_fragments
|
||||||
|
|
||||||
|
Test module
|
||||||
|
|
||||||
|
AUTHOR: Ansible Core Team
|
||||||
|
|
||||||
|
EXAMPLES:
|
||||||
|
|
||||||
|
|
||||||
|
RETURN VALUES:
|
||||||
|
|
||||||
|
- a_first A first result.
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
|
||||||
|
- m_middle This should be in the middle.
|
||||||
|
Has some more data
|
||||||
|
returned: success and 1st of month
|
||||||
|
type: dict
|
||||||
|
contains:
|
||||||
|
|
||||||
|
- suboption A suboption.
|
||||||
|
choices: [ARF, BARN, c_without_capital_first_letter]
|
||||||
|
type: str
|
||||||
|
|
||||||
|
- y_notlast A return from fragment
|
||||||
|
returned: it depends TM
|
||||||
|
type: str
|
||||||
|
|
||||||
|
- z_last A a return from fragment with merge.
|
||||||
|
example: this is a merge
|
||||||
|
returned: success
|
||||||
|
type: str
|
||||||
|
|
||||||
Loading…
Reference in New Issue