diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:04:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:04:41 +0000 |
commit | 975f66f2eebe9dadba04f275774d4ab83f74cf25 (patch) | |
tree | 89bd26a93aaae6a25749145b7e4bca4a1e75b2be /ansible_collections/community/okd/ci/downstream_fragments.py | |
parent | Initial commit. (diff) | |
download | ansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.tar.xz ansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.zip |
Adding upstream version 7.7.0+dfsg.upstream/7.7.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/okd/ci/downstream_fragments.py')
-rwxr-xr-x | ansible_collections/community/okd/ci/downstream_fragments.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ansible_collections/community/okd/ci/downstream_fragments.py b/ansible_collections/community/okd/ci/downstream_fragments.py new file mode 100755 index 000000000..727be61e8 --- /dev/null +++ b/ansible_collections/community/okd/ci/downstream_fragments.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import json +import sys +import yaml + +with open("./rendereddocfragments.txt", 'w') as df_fd: + with open(sys.argv[2], 'r') as fd: + json_docs = json.load(fd) + + json_docs[sys.argv[1]]['doc'].pop('collection', '') + json_docs[sys.argv[1]]['doc'].pop('filename', '') + json_docs[sys.argv[1]]['doc'].pop('has_action', '') + + df_fd.write('DOCUMENTATION = """\n') + df_fd.write(yaml.dump(json_docs[sys.argv[1]]['doc'], default_flow_style=False)) + df_fd.write('"""\n\n') + + df_fd.write('EXAMPLES = """') + df_fd.write(json_docs[sys.argv[1]]['examples']) + df_fd.write('"""\n\n') + + df_fd.write('RETURN = r"""') + data = json_docs[sys.argv[1]]['return'] + if isinstance(data, dict): + df_fd.write(yaml.dump(data, default_flow_style=False)) + else: + df_fd.write(data) + df_fd.write('"""\n\n') |