Skip to content

Commit

Permalink
Merge pull request #181 from jeffmcutter/preupg_get_inhibitors
Browse files Browse the repository at this point in the history
Collect inhibitor and high not enough space on RHEL 6.
  • Loading branch information
jeffmcutter authored Apr 30, 2024
2 parents 0f4b3d2 + 7a09531 commit 3a1abd7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/preupg_get_inhibitors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
minor_changes:
- For RHEL 6 upgrades, similarly capture inhibitor and high errors for not enough space for display in output and inclusion into set_stats for leapp_inhibitors.
...
6 changes: 0 additions & 6 deletions roles/analysis/tasks/analysis-leapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,4 @@
leapp_inhibitors: "{{ leapp_inhibitors | default([]) + [item] }}"
when: "'inhibitor' in item.flags"
loop: "{{ leapp_report_json.entries }}"

- name: analysis-leapp | Set stats for leapp_inhibitors
ansible.builtin.set_stats:
data:
leapp_inhibitors: "{{ leapp_inhibitors }}"

...
25 changes: 25 additions & 0 deletions roles/analysis/tasks/analysis-preupg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,29 @@
ansible.builtin.set_fact:
upgrade_inhibited: "{{ preupg_return_codes[preupg.rc].inhibited }}"

# We already have preupg_report_txt that has this info in it.
# However, this makes it work the same as leapp which is using
# some awk magic to parse the file.
- name: analysis-preupg | Collect inhibitors
ansible.builtin.command:
cmd: grep "preupg.risk.EXTREME:" {{ result_filename }}
register: results_inhibitors
changed_when: false
failed_when: false

- name: analysis-preupg | Collect high errors
ansible.builtin.command:
cmd: egrep -i "preupg.risk.HIGH:.*not enough free space" {{ result_filename }}
register: results_errors
changed_when: false
failed_when: false

- name: analysis-preupg | Check for not enough space errors and update upgrade_inhibited
ansible.builtin.set_fact:
upgrade_inhibited: true
when: results_errors.stdout_lines | length > 0

- name: analysis-preupg | Capture inhibitors in a list leapp_inhibitors
ansible.builtin.set_fact:
leapp_inhibitors: "{{ results_inhibitors.stdout_lines + results_errors.stdout_lines }}"
...
5 changes: 5 additions & 0 deletions roles/analysis/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
ansible.builtin.include_tasks: analysis-leapp.yml
when: ansible_distribution_major_version|int >= 7

- name: Set stats for leapp_inhibitors
ansible.builtin.set_stats:
data:
leapp_inhibitors: "{{ leapp_inhibitors }}"

- name: Notify analysis report is done handler
ansible.builtin.assert:
that: true
Expand Down
4 changes: 2 additions & 2 deletions roles/parse_leapp_report/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
# Not all inhibitors are high.
- name: Collect inhibitors
ansible.builtin.command:
cmd: awk '/\(inhibitor\)/,/^-------/' /var/log/leapp/leapp-report.txt
cmd: awk '/\(inhibitor\)/,/^-------/' {{ result_filename }}
register: results_inhibitors
changed_when: false
failed_when: false

- name: Collect high errors
ansible.builtin.command:
cmd: awk '/high \(error\)/,/^-------/' /var/log/leapp/leapp-report.txt
cmd: awk '/high \(error\)/,/^-------/' {{ result_filename }}
register: results_errors
changed_when: false
failed_when: false
Expand Down

0 comments on commit 3a1abd7

Please sign in to comment.