Skip to content

Commit

Permalink
fix: Fail on the s390x architecture with a not supported msg
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrosi committed Apr 12, 2024
1 parent 4d9573a commit 3614220
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
- name: Set platform/version specific variables
include_tasks: tasks/set_vars.yml

- name: Fail on s390x architecture
fail:
msg: >-
This role does not support s390x architecture.
Let us know if you need the role to support it.
when: ansible_architecture == 's390x'

- name: Ensure required packages are installed
package:
name: "{{ __bootloader_packages }}"
Expand Down
5 changes: 5 additions & 0 deletions tests/tasks/assert_fail_on_s390x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: MIT
---
- name: Assert failure on the s390x architecture
assert:
that: ansible_architecture == 's390x' in ansible_failed_result.msg
3 changes: 3 additions & 0 deletions tests/tests_add_rm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
that: bootloader_facts | selectattr('title', 'defined') |
selectattr('title', 'search', 'Clone2') |
list | length == 0
rescue:
- name: Assert failure on s390x architecture
include_tasks: tasks/assert_fail_on_s390x.yml
always:
- name: Remove cloned kernels
command: >-
Expand Down
11 changes: 9 additions & 2 deletions tests/tests_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
- name: Ensure that the role runs with default parameters
hosts: all
gather_facts: false # for testing the role fact gathering
roles:
- linux-system-roles.bootloader
tasks:
- name: Run in a block to clean up afterwards
block:
- name: Run with default parameters
include_role:
name: linux-system-roles.bootloader
rescue:
- name: Assert failure on s390x architecture
include_tasks: tasks/assert_fail_on_s390x.yml
3 changes: 3 additions & 0 deletions tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
name: caller
vars:
roletoinclude: linux-system-roles.bootloader
rescue:
- name: Assert failure on s390x architecture
include_tasks: tasks/assert_fail_on_s390x.yml
always:
- name: Cleanup
file:
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_password.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
- name: Verify that user conf doesn't exist
assert:
that: not __bootloader_user_conf_stat.stat.exists
rescue:
- name: Assert failure on s390x architecture
include_tasks: tasks/assert_fail_on_s390x.yml
always:
- name: Remove boot loader password
vars:
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
regex('set timeout=4')
register: __bootloader_default_grub_content
changed_when: false
rescue:
- name: Assert failure on s390x architecture
include_tasks: tasks/assert_fail_on_s390x.yml
always:
- name: Remove cloned kernels
command: >-
Expand Down
1 change: 1 addition & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
---
# ansible_facts required by the role
__bootloader_required_facts:
- architecture
- distribution
- distribution_major_version
- distribution_version
Expand Down

0 comments on commit 3614220

Please sign in to comment.