Use distribution_major_version for Debian and CentOS
Debian does include minor versioning into distribution_version facts causing versions to look like "12.2" or "11.4", which is causing issues once debian is minorly updated since there might be no repo container to satisfy such specific request across the board (ie having repo 11.3 while compute reports 11.4). Thus we're taking into account only major versions for these distros. Same approach has been taken for building wheels in project-config [1] [1] https://review.opendev.org/c/openstack/project-config/+/897545 Change-Id: Iaf6ed4dd5e01b25b5935b959c73ab657cfefef47
This commit is contained in:
parent
824639308e
commit
965cad09fa
@ -46,7 +46,11 @@ venv_build_targets: |-
|
||||
{% set targets = {} %}
|
||||
{% for item in ((groups[venv_build_group] | default([])) | reverse) %}
|
||||
{% set distro = (hostvars[item]['ansible_facts']['distribution'] | lower) | replace(' ', '_') %}
|
||||
{% set distro_ver = hostvars[item]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %}
|
||||
{% if distro == 'debian' or distro == 'centos' %}
|
||||
{% set distro_ver = hostvars[item]['ansible_facts']['distribution_major_version'] %}
|
||||
{% else %}
|
||||
{% set distro_ver = hostvars[item]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %}
|
||||
{% endif %}
|
||||
{% set arch = hostvars[item]['ansible_facts']['architecture'] %}
|
||||
{% set distro_arch = [distro, distro_ver, arch] | join('-') %}
|
||||
{% if distro_arch not in targets %}
|
||||
@ -60,7 +64,11 @@ _venv_wheels_play_hosts: |-
|
||||
{% for host in ansible_play_hosts %}
|
||||
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
|
||||
{% set distro = (hostvars[host]['ansible_facts']['distribution'] | lower) | replace(' ', '_') %}
|
||||
{% set distro_ver = hostvars[host]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %}
|
||||
{% if distro == 'debian' or distro == 'centos' %}
|
||||
{% set distro_ver = hostvars[host]['ansible_facts']['distribution_major_version'] %}
|
||||
{% else %}
|
||||
{% set distro_ver = hostvars[host]['ansible_facts']['distribution_version'].split('.')[:2] | join('.') %}
|
||||
{% endif %}
|
||||
{% set distro_arch = [distro, distro_ver, arch] | join('-') %}
|
||||
{% if distro_arch not in wheel_groups %}
|
||||
{% set _ = wheel_groups.update({distro_arch: [host]}) %}
|
||||
@ -79,10 +87,17 @@ _venv_wheels_first_play_hosts: |-
|
||||
|
||||
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"
|
||||
|
||||
|
||||
_venv_build_dist: >-
|
||||
{{ (ansible_facts['distribution'] | lower == 'debian' or ansible_facts['distribution'] | lower == 'centos') | ternary(
|
||||
ansible_facts['distribution_major_version'],
|
||||
ansible_facts['distribution_version'].split('.')[:2] | join('.')
|
||||
) }}
|
||||
|
||||
_venv_build_dist_arch: >-
|
||||
{{
|
||||
((ansible_facts['distribution'] | lower) | replace(' ', '_')) ~ '-' ~
|
||||
(ansible_facts['distribution_version'].split('.')[:2] | join('.')) ~ '-' ~
|
||||
_venv_build_dist ~ '-' ~
|
||||
(ansible_facts['architecture'] | lower)
|
||||
}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user