kxr / ocpcr

Ansible playbook to generate an HTML cluster overview report for OpenShift 3
GNU General Public License v3.0
27 stars 20 forks source link

Install the required `python-jmespath` package #8

Closed AlexonOliveiraRH closed 1 year ago

AlexonOliveiraRH commented 1 year ago

Install the required python-jmespath package

kxr commented 1 year ago

Hello @AlexonOliveiraRH. Thank you for submitting this PR. I don't remember, neither can I find any usage of jmespath in my code. Can you double check if this package is really required?

AlexonOliveiraRH commented 1 year ago

Hello @AlexonOliveiraRH. Thank you for submitting this PR. I don't remember, neither can I find any usage of jmespath in my code. Can you double check if this package is really required?

Hey @kxr. I appreciate your reply. When I ran this the last time, it was failing and requiring me to install this package in order to use the json_query filter. The files are:

$ grep -i -R json_query
report/includes/core_pods.j2:                        {% set on = hostvars['localhost'].ordered_nodes.stdout | from_json | json_query("[?name=='"+p['node']+"']") | first %}
report/includes/node_resources.j2:                {% set n = hostvars['localhost'].node_resources.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
report/includes/node_resources.j2:                {% set ua = hostvars['localhost'].node_resources.stdout | from_json | json_query("[?name=='Unassigned']") | first %}
report/includes/node_status.j2:                {% set n = hostvars['localhost'].node_info.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
report/includes/node_versions.j2:                {% set n = hostvars['localhost'].node_info.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
report/includes/pod_stats.j2:                {% set n = hostvars['localhost'].pod_stats.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
report/includes/pod_stats.j2:            {% set ua = hostvars['localhost'].pod_stats.stdout | from_json | json_query("[?name=='Unassigned']") | first %}
report/includes/system_resources.j2:                {% set n = hostvars['localhost'].node_info.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
report/includes/system_services.j2:                {% set n = hostvars['localhost'].node_info.stdout | from_json | json_query("[?name=='"+on['name']+"']") | first %}
kxr commented 1 year ago

Got it. Makes sense now. You are right it must be json_query. Just found that Ansible documentation also lists jmespath as a requirement for json_query:

You must manually install the jmespath dependency on the Ansible controller before using this filter. 

Thank you. I really appreciate your contribution