Skip to content

Commit

Permalink
To fix Sec builder doc_generator failure and requirements issues (#36)
Browse files Browse the repository at this point in the history
* fix sec builder failure issue

* fix main.yaml

* length fix

Signed-off-by: Sumit Jaiswal <[email protected]>

* fragment fix

Signed-off-by: Sumit Jaiswal <[email protected]>

Signed-off-by: Sumit Jaiswal <[email protected]>
  • Loading branch information
justjais authored Dec 29, 2022
1 parent 8fbb429 commit ba6e0b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
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'] }}"
"{{ 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

0 comments on commit ba6e0b8

Please sign in to comment.