Skip to content

Commit

Permalink
tests: simplify distro check in tests_environments.yml
Browse files Browse the repository at this point in the history
Simplify a distro check in tests_environments.yml to ease potentially
adding more EL distros:
- because of the short-circuiting of expressions, all the "or"
  conditions are run currently only on "CentOS" and "RedHat"
- since CentOS Stream is the only "unversioned" EL distro, move its
  condition as the first after the distro check
- drop the name check, leaving only the version check, in any other case
  (i.e. currently on "RedHat")

This makes is possible to support more EL distros in this check, and in
case they are versioned all it is needed is to tweak the first
condition (i.e. the check for "ansible_distribution not in ...").

There is no behaviour change.

Signed-off-by: Pino Toscano <[email protected]>
  • Loading branch information
ptoscano committed Oct 22, 2024
1 parent 8693541 commit ee5e4f8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tests/tests_environments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@
when:
- >-
ansible_distribution not in ["CentOS", "RedHat"]
or (ansible_distribution == "RedHat"
and ansible_distribution_version is version("8.6", ">="))
or (ansible_distribution == "CentOS"
and ansible_distribution_major_version | int >= 8)
or (ansible_distribution_version is version("8.6", ">="))
block:
- name: Get enabled environments
include_tasks: tasks/list_environments.yml
Expand Down

0 comments on commit ee5e4f8

Please sign in to comment.