Skip to content

Commit

Permalink
Fix count of errors and inhibitors in ansible tasks
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Waltlova <[email protected]>
  • Loading branch information
andywaltlova committed Feb 8, 2024
1 parent bd5be3b commit c058239
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions playbooks/leapp_preupgrade_ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,17 @@
- name: Set message if inhibitors or errors present
set_fact:
message: >-
"The upgrade cannot proceed. Your system has {{ error_count + inhibitor_count }} inhibitor{{ 's' if inhibitor_count + error_count != 1 else '' }}
"The upgrade cannot proceed. Your system has {{ error_count | int + inhibitor_count | int }} inhibitor{{ 's' if inhibitor_count | int + error_count | int != 1 else '' }}
out of {{ total_problems_count }} potential problems."
when: inhibitor_count != 0 or error_count != 0
when: inhibitor_count != "0" or error_count != "0"


- name: Set message if no inhibitors and no errors present
set_fact:
message: >-
{{ 'No problems found. The system is ready for upgrade.' if total_problems_count == 0
else 'The upgrade can proceed. However, there is one or more warnings about issues that might occur after the upgrade.'}}
when: inhibitor_count == 0 and error_count == 0
when: inhibitor_count == "0" and error_count == "0"

- name: Set result
ansible.builtin.set_fact:
Expand Down
2 changes: 1 addition & 1 deletion playbooks/leapp_upgrade_ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
set_fact:
message: >-
"The upgrade cannot proceed.
Your system has {{ error_count + inhibitor_count }} inhibitor{{ 's' if inhibitor_count + error_count != 1 else '' }}
Your system has {{ error_count | int + inhibitor_count | int }} inhibitor{{ 's' if inhibitor_count | int + error_count | int != 1 else '' }}
out of {{ total_problems_count }} potential problems."
- name: Set message if leapp upgrade succeeded
Expand Down

0 comments on commit c058239

Please sign in to comment.