Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To fix Sec builder doc_generator failure and requirements issues #36

Merged
merged 4 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelogs/fragments/doc_generator_fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
bugfixes:
- To fix the doc_generator issue for secbuity RM builder using OpenAPI JSON file.
- https://github.com/ansible-community/ansible.content_builder/issues/28
- https://github.com/ansible-community/ansible.content_builder/issues/29
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ black==22.3.0
Jinja2==3.0.3
ansible-core
jsonschema
oyaml
2 changes: 1 addition & 1 deletion roles/module_openapi/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
register: tmp_directory

- name: EXECUTE the python script
ansible.builtin.command: python3 doc_generator.py "{{ plugin['rm_swagger_json'] }}"
ansible.builtin.command: python3 "{{ role_path }}"/templates/doc_generator.py "{{ plugin['rm_swagger_json'] }}"
NilashishC marked this conversation as resolved.
Show resolved Hide resolved
"{{ plugin['api_object_path'] }}"
"{{ plugin['name'] }}"
"{{ plugin['module_version'] }}"
Expand Down
15 changes: 8 additions & 7 deletions roles/module_openapi/templates/doc_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,14 +881,15 @@ def main():
}
)
else:
# post_properties = get_api_param_properties_recursively(
# "$ref", api_object, data, global_var_mgmt_dict
# )
post_properties = get_api_param_properties_recursively(
"schema", api_object, data, global_var_mgmt_dict
)
if str(sys.argv[6]) == "trendmicro":
post_properties = get_api_param_properties_recursively(
"$ref", api_object, data, global_var_mgmt_dict
)
elif str(sys.argv[6]) == "fortinet":
post_properties = get_api_param_properties_recursively(
"schema", api_object, data, global_var_mgmt_dict
)

attribute_map_by_param = {}
module_name = str(sys.argv[3])
module_resource = str(sys.argv[5])
module_version = str(sys.argv[4])
Expand Down