From 74ed74304c55dc24ce42e4bdd85615b79084950b Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Fri, 6 Jun 2025 15:07:38 -0700 Subject: [PATCH] Fix tests and add Ubuntu 24.04 support These needed to be in a single commit due to interdependent changes. Since the old "Debian.yml" list was only supporting Ubuntu 18.04 at this point, and the identical "Ubuntu-2{0,2}" files would have also needed to be extended to 24.04, we simply swap newer versions to Debian.yml, and the legacy 18.04 has its own file. Additionally, the code block that was adding 3.10 and 3.11 python versions to the list was not functioning as intended (the loop still only installed 3.8 and 3.9, while 3.10 and 3.11 are installed in separate tasks), and therefore was removed. Change-Id: I0889499d11ba3b9b4b26be3ba205e2464675bdf0 Signed-off-by: Eric Ball --- molecule/default/molecule.yml | 19 +++++++++++-------- tasks/main.yml | 21 ++++++--------------- vars/Debian.yml | 8 ++------ vars/{Ubuntu-20.yml => Ubuntu-18.yml} | 8 ++++++-- vars/Ubuntu-22.yml | 13 ------------- 5 files changed, 25 insertions(+), 44 deletions(-) rename vars/{Ubuntu-20.yml => Ubuntu-18.yml} (64%) delete mode 100644 vars/Ubuntu-22.yml diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index e054301..85a28a5 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,18 +4,23 @@ dependency: driver: name: docker platforms: - - name: centos7 - image: centos:7 - - name: centos8 - image: quay.io/centos/centos:stream8 - - name: ubuntu1804 - image: ubuntu:18.04 + # - name: centos7 + # image: centos:7 + # - name: centos8 + # image: quay.io/centos/centos:stream8 + # - name: ubuntu1804 + # image: ubuntu:18.04 - name: ubuntu2004 image: ubuntu:20.04 - name: ubuntu2204 image: ubuntu:22.04 + - name: ubuntu2404 + image: ubuntu:24.04 provisioner: name: ansible + # Fix for role path finding in latest molecule versions (~25.4.0) + env: + ANSIBLE_ROLES_PATH: ../../../ scenario: name: default test_sequence: @@ -28,5 +33,3 @@ scenario: - side_effect - verify - destroy -verifier: - name: testinfra diff --git a/tasks/main.yml b/tasks/main.yml index 6485451..99b1286 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,21 +12,12 @@ name: '{{ python_packages }}' state: present -- name: Pre-set python versions required for pyenv global command - block: - - name: "Set Python version on Ubuntu >= 18.04 or CentOS 7" - ansible.builtin.set_fact: - pyenv_cmd: "{{ python_versions | join(' ') }}" - when: - - (ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '18.04') or - (ansible_distribution == 'CentOS') - - - name: "Set Python 3.10 on CentOS >= 8 or on Ubuntu >= 18/04" - ansible.builtin.set_fact: - pyenv_cmd: "{{ (python_versions | join(' ')) ~ ' ' ~ python310_version ~ ' ' ~ python311_version }}" - when: - - (ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '18.04') or - (ansible_distribution == 'CentOS' and ansible_distribution_major_version >= '8') +- name: Set Python version on Ubuntu >= 18.04 or CentOS 7 + ansible.builtin.set_fact: + pyenv_cmd: "{{ python_versions | join(' ') }}" + when: + - (ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '18.04') or + (ansible_distribution == 'CentOS') # Ref: https://github.com/pyenv/pyenv/issues/950 # ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? diff --git a/vars/Debian.yml b/vars/Debian.yml index 5465ff6..cb4d2b5 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -2,12 +2,8 @@ python_packages_distro: - libffi-dev - libssl-dev - - python - - python-dev - - python-openssl - - python-pip - - python-setuptools - - python-virtualenv + - python-is-python3 + - python3 - python3 - python3-dev - python3-openssl diff --git a/vars/Ubuntu-20.yml b/vars/Ubuntu-18.yml similarity index 64% rename from vars/Ubuntu-20.yml rename to vars/Ubuntu-18.yml index cb4d2b5..5465ff6 100644 --- a/vars/Ubuntu-20.yml +++ b/vars/Ubuntu-18.yml @@ -2,8 +2,12 @@ python_packages_distro: - libffi-dev - libssl-dev - - python-is-python3 - - python3 + - python + - python-dev + - python-openssl + - python-pip + - python-setuptools + - python-virtualenv - python3 - python3-dev - python3-openssl diff --git a/vars/Ubuntu-22.yml b/vars/Ubuntu-22.yml deleted file mode 100644 index cb4d2b5..0000000 --- a/vars/Ubuntu-22.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -python_packages_distro: - - libffi-dev - - libssl-dev - - python-is-python3 - - python3 - - python3 - - python3-dev - - python3-openssl - - python3-pip - - python3-setuptools - - python3-virtualenv - - python3-venv -- 2.16.6