Skip to content

Commit

Permalink
Add result_fact_cacheable var (#231)
Browse files Browse the repository at this point in the history
* Fix cacheable for parse_leapp_report

* change var to match previous PR

* Adding changelog for change

---------

Co-authored-by: Kaleb Stolee <[email protected]>
  • Loading branch information
kalsto and Kaleb Stolee authored Nov 14, 2024
1 parent eb7e13c commit db1f54b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/add_cachable_variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- Add optional parameter for allowing caching of facts within AAP
5 changes: 3 additions & 2 deletions roles/parse_leapp_report/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ The `parse_leapp_report` role is used by the `analysis` or `upgrade` roles to ch
| Name | Default value | Description |
|-------------------------|-----------------------|-----------------------------------------------------|
| result_filename | "/var/log/leapp/leapp-report.txt" | Path of the Leapp pre-upgrade report file. |
| result_filename_prefix | "/var/log/leapp/leapp-report | The path used and the prefix name setting for the Leapp report |
| result_filename_json | "{{ result_filename_prefix }}.json | JSON filename using the selected "result_filename_prefix" |
| result_filename_prefix | "/var/log/leapp/leapp-report" | The path used and the prefix name setting for the Leapp report |
| result_filename_json | "{{ result_filename_prefix }}.json" | JSON filename using the selected "result_filename_prefix" |
| result_fact_cacheable | false | Allow the results from parsing the LEAPP report be cacheable (primarily for AAP) |

## Example playbook

Expand Down
1 change: 1 addition & 0 deletions roles/parse_leapp_report/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# defaults file for parse_leapp_report
result_filename_prefix: /var/log/leapp/leapp-report
result_filename_json: "{{ result_filename_prefix }}.json"
result_fact_cacheable: false
...
2 changes: 2 additions & 0 deletions roles/parse_leapp_report/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

- name: Parse report results
ansible.builtin.set_fact:
cacheable: "{{ result_fact_cacheable }}"
leapp_report_txt: "{{ results_txt.content | b64decode | split('\n') }}"
leapp_report_json: "{{ results_json.content | b64decode | from_json }}"

- name: Check for inhibitors
ansible.builtin.set_fact:
cacheable: "{{ result_fact_cacheable }}"
upgrade_inhibited: true
leapp_inhibitors: "{{ leapp_inhibitors | default([]) + [item] }}"
when:
Expand Down

0 comments on commit db1f54b

Please sign in to comment.