Add family fallback for RHEL to register as RedHat (#77371)

* Add family fallback for RHEL to register as RedHat

* Update tests to properly assert RHEL behavior
pull/77376/head
Matt Martz 3 years ago committed by GitHub
parent f03624e295
commit 4723eb9caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- Interpreter discovery - Add ``RHEL`` to ``OS_FAMILY_MAP`` for correct family fallback for interpreter discovery
(https://github.com/ansible/ansible/issues/77368)

@ -501,7 +501,7 @@ class Distribution(object):
""" """
# keep keys in sync with Conditionals page of docs # keep keys in sync with Conditionals page of docs
OS_FAMILY_MAP = {'RedHat': ['RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', OS_FAMILY_MAP = {'RedHat': ['RedHat', 'RHEL', 'Fedora', 'CentOS', 'Scientific', 'SLC',
'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS',
'OEL', 'Amazon', 'Virtuozzo', 'XenServer', 'Alibaba', 'OEL', 'Amazon', 'Virtuozzo', 'XenServer', 'Alibaba',
'EulerOS', 'openEuler', 'AlmaLinux', 'Rocky', 'TencentOS', 'EulerOS', 'openEuler', 'AlmaLinux', 'Rocky', 'TencentOS',

@ -11,6 +11,7 @@
set_fact: set_fact:
distro: '{{ ansible_distribution | default("unknown") | lower }}' distro: '{{ ansible_distribution | default("unknown") | lower }}'
distro_version: '{{ ansible_distribution_version | default("unknown") }}' distro_version: '{{ ansible_distribution_version | default("unknown") }}'
distro_major_version: '{{ ansible_distribution_major_version | default("unknown") }}'
os_family: '{{ ansible_os_family | default("unknown") }}' os_family: '{{ ansible_os_family | default("unknown") }}'
- name: test that python discovery is working and that fact persistence makes it only run once - name: test that python discovery is working and that fact persistence makes it only run once
@ -156,11 +157,11 @@
assert: assert:
that: that:
# rhel 6/7 # rhel 6/7
- (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and distro_version is version('8','<')) or distro_version is version('8','>=') - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and distro_major_version is version('8','<')) or distro_major_version is version('8','>=')
# rhel 8 # rhel 8
- (auto_out.ansible_facts.discovered_interpreter_python == '/usr/libexec/platform-python' and distro_version is version('8','==')) or distro_version is version('8','!=') - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/libexec/platform-python' and distro_major_version is version('8','==')) or distro_major_version is version('8','!=')
# rhel 9 # rhel 9
- (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3' and distro_version is version('9','==')) or distro_version is version('9','!=') - (auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3' and distro_major_version is version('9','==')) or distro_major_version is version('9','!=')
when: distro == 'redhat' when: distro == 'redhat'
- name: ubuntu assertions - name: ubuntu assertions

Loading…
Cancel
Save