Remove Python 2 specific parts from integration tests (#10897)

* Remove Python 2 specific parts from integration tests.

* Remove more constraints.
This commit is contained in:
Felix Fontein 2025-10-12 08:48:50 +02:00 committed by GitHub
commit 21122e926b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 25 additions and 308 deletions

View file

@ -71,7 +71,7 @@
- name: Install BeautifulSoup
pip:
name: "{{ 'BeautifulSoup' if ansible_python_version is version('3', '<') else 'BeautifulSoup4' }}"
name: BeautifulSoup4
extra_args: "-c {{ remote_constraints }}"
- name: Get all current balancer pool members attributes

View file

@ -51,49 +51,6 @@
apt: name=zip state=latest
when: ansible_facts.pkg_mgr == 'apt'
- name: Install prerequisites for backports.lzma when using python2 (non OSX)
block:
- name: Set liblzma package name depending on the OS
set_fact:
liblzma_dev_package:
Debian: liblzma-dev
RedHat: xz-devel
Suse: xz-devel
- name: Ensure liblzma-dev is present to install backports-lzma
package: name={{ liblzma_dev_package[ansible_os_family] }} state=latest
when: ansible_os_family in liblzma_dev_package.keys()
when:
- ansible_python_version.split('.')[0] == '2'
- ansible_os_family != 'Darwin'
- name: Install prerequisites for backports.lzma when using python2 (OSX)
block:
- name: Find brew binary
command: which brew
register: brew_which
- name: Get owner of brew binary
stat: path="{{ brew_which.stdout }}"
register: brew_stat
- name: "Install package"
homebrew:
name: xz
state: present
update_homebrew: false
become: true
become_user: "{{ brew_stat.stat.pw_name }}"
# Newer versions of brew want to compile a package which takes a long time. Do not upgrade homebrew until a
# proper solution can be found
environment:
HOMEBREW_NO_AUTO_UPDATE: "True"
when:
- ansible_python_version.split('.')[0] == '2'
- ansible_os_family == 'Darwin'
- name: Ensure backports.lzma is present to create test archive (pip)
pip: name=backports.lzma state=latest
when: ansible_python_version.split('.')[0] == '2'
register: backports_lzma_pip
- name: Define formats to test
set_fact:
formats:
@ -138,8 +95,3 @@
loop: "{{ formats }}"
loop_control:
loop_var: format
# Test cleanup
- name: Remove backports.lzma if previously installed (pip)
pip: name=backports.lzma state=absent
when: backports_lzma_pip is changed

View file

@ -22,11 +22,8 @@
# to /etc/init/ureadahead.conf.disabled by cloud-init' clashes with `local diversion of
# /etc/init/ureadahead.conf to /etc/init/ureadahead.conf.distrib
# https://bugs.launchpad.net/ubuntu/+source/ureadahead/+bug/997838
# Will also have to skip on OpenSUSE when running on Python 2 on newer Leap versions
# (!= 42 and >= 15) as cloud-init will install the Python 3 package, breaking our build on py2.
when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 14)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and ansible_python.version.major != 3)
- not (ansible_os_family == "Suse" and ansible_distribution_major_version|int == 15)
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int == 8) # TODO: cannot start service
- not (ansible_distribution == 'Archlinux') # TODO: package seems to be broken, cannot be downloaded from mirrors?

View file

@ -1,9 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: delete backports.lzma
pip:
name: backports.lzma
state: absent

View file

@ -37,24 +37,7 @@
state: latest
when: ansible_os_family == 'Debian'
- name: Install prerequisites for backports.lzma when using python2 (non OSX)
block:
- name: Set liblzma package name depending on the OS
set_fact:
liblzma_dev_package:
Debian: liblzma-dev
RedHat: xz-devel
Suse: xz-devel
- name: Ensure liblzma-dev is present to install backports-lzma
package:
name: "{{ liblzma_dev_package[ansible_os_family] }}"
state: latest
when: ansible_os_family in liblzma_dev_package.keys()
when:
- ansible_python_version.split('.')[0] == '2'
- ansible_os_family != 'Darwin'
- name: Install prerequisites for backports.lzma when using python2 (OSX)
- name: Ensure xz is present to create compressed file (macOS)
block:
- name: Find brew binary
command: which brew
@ -77,14 +60,6 @@
when:
- ansible_os_family == 'Darwin'
- name: Ensure backports.lzma is present to create test archive (pip)
pip:
name: backports.lzma
state: latest
when: ansible_python_version.split('.')[0] == '2'
notify:
- delete backports.lzma
- name: Generate compressed files
shell: |
gzip < {{ item }} > {{ item }}.gz

View file

@ -82,11 +82,6 @@
- 'not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<") and
item.1 == "overwrite_another_fs")'
# The xfsprogs package on newer versions of OpenSUSE (15+) require Python 3, we skip this on our Python 2 container
# OpenSUSE 42.3 Python2 and the other py3 containers are not affected so we will continue to run that
- 'not (ansible_os_family == "Suse" and ansible_distribution_major_version|int != 42 and
item.0.key == "xfs" and ansible_python.version.major == 2)'
# TODO: something seems to be broken on Alpine
- 'not (ansible_distribution == "Alpine")'

View file

@ -10,8 +10,6 @@
ansible.builtin.package:
name: '{{ item }}'
state: present
# xfsprogs on OpenSUSE requires Python 3, skip this for our newer Py2 OpenSUSE builds
when: not (item == 'xfsprogs' and ansible_os_family == 'Suse' and ansible_python.version.major == 2 and ansible_distribution_major_version|int != 42)
loop:
- e2fsprogs
- xfsprogs
@ -48,7 +46,7 @@
- name: "Install btrfs progs (OpenSuse)"
ansible.builtin.package:
name:
- python{{ ansible_python.version.major }}-xml
- python3-xml
- btrfsprogs
state: present
when: ansible_os_family == 'Suse'

View file

@ -15,24 +15,13 @@
# setup etcd3 for supported distros
- block:
- name: python 2
set_fact:
python_suffix: ""
when: ansible_python_version is version('3', '<')
- name: python 3
set_fact:
python_suffix: "-py3"
when: ansible_python_version is version('3', '>=')
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}{{ python_suffix }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}{{ python_suffix }}.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}{{ python_suffix }}.yml'
- '{{ ansible_os_family }}{{ python_suffix }}.yml'
- 'default{{ python_suffix }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_os_family }}.yml'
- 'default.yml'
paths: '../vars'

View file

@ -1,6 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
etcd3_pip_module: etcd3<0.12

View file

@ -1,8 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# SuSE's python 3.6.10 comes with six 1.11.0 as distutil
# we restrict to etcd3 < 0.11 to avoid pip to try to upgrade six
etcd3_pip_module: 'etcd3<0.11'

View file

@ -19,17 +19,10 @@
name: '{{ item }}'
loop: '{{ openldap_packages_name }}'
- name: Install python-ldap (Python 3)
- name: Install python-ldap
become: true
package:
name: '{{ python_ldap_package_name_python3 }}'
when: ansible_python_version is version('3.0', '>=')
- name: Install python-ldap (Python 2)
become: true
package:
name: '{{ python_ldap_package_name }}'
when: ansible_python_version is version('3.0', '<')
- name: Make sure OpenLDAP service is stopped
become: true

View file

@ -29,17 +29,11 @@
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6']
block:
- name: Install cryptography (Python 3)
- name: Install cryptography
become: true
package:
name: '{{ cryptography_package_name_python3 }}'
when: not cryptography_from_pip and ansible_python_version is version('3.0', '>=')
- name: Install cryptography (Python 2)
become: true
package:
name: '{{ cryptography_package_name }}'
when: not cryptography_from_pip and ansible_python_version is version('3.0', '<')
when: not cryptography_from_pip
- name: Install cryptography (pip)
become: true
@ -48,17 +42,11 @@
extra_args: "-c {{ remote_constraints }}"
when: cryptography_from_pip
- name: Install pyOpenSSL (Python 3)
- name: Install pyOpenSSL
become: true
package:
name: '{{ pyopenssl_package_name_python3 }}'
when: pyopenssl_package_name_python3 is defined and ansible_python_version is version('3.0', '>=')
- name: Install pyOpenSSL (Python 2)
become: true
package:
name: '{{ pyopenssl_package_name }}'
when: pyopenssl_package_name is defined and ansible_python_version is version('3.0', '<')
when: pyopenssl_package_name_python3 is defined
- name: register openssl version
shell: "openssl version | cut -d' ' -f2"

View file

@ -20,25 +20,15 @@
- meta: end_play
when: ansible_facts.distribution == 'Fedora' and ansible_facts.distribution_major_version == '34'
- name: python 2
set_fact:
python_suffix: ''
when: ansible_python_version is version('3', '<')
- name: python 3
set_fact:
python_suffix: -py3
when: ansible_python_version is version('3', '>=')
- name: Include distribution and Python version specific variables
include_vars: '{{ lookup(''first_found'', params) }}'
vars:
params:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}{{ python_suffix }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}{{ python_suffix }}.yml'
- '{{ ansible_os_family }}{{ python_suffix }}.yml'
- default{{ python_suffix }}.yml
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml'
- default.yml
paths:
- '{{ role_path }}/vars'

View file

@ -1,13 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql"
- "postgresql-common"
- "python-psycopg2"
pg_hba_location: "/etc/postgresql/9.4/main/pg_hba.conf"
pg_dir: "/var/lib/postgresql/9.4/main"
pg_ver: 9.4

View file

@ -1,17 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- postgresql95-server
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /usr/local/pgsql/data
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"
pg_ver: 9.5
pg_user: pgsql
pg_group: pgsql
locale_latin_suffix: .ISO8859-1
locale_utf8_suffix: .UTF-8

View file

@ -5,7 +5,7 @@
postgresql_packages:
- postgresql95-server
- py27-psycopg2
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /usr/local/pgsql/data
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"

View file

@ -1,17 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- postgresql95-server
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /usr/local/pgsql/data
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"
pg_ver: 9.5
pg_user: pgsql
pg_group: pgsql
locale_latin_suffix: .ISO8859-1
locale_utf8_suffix: .UTF-8

View file

@ -4,12 +4,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- postgresql96-server
- py27-psycopg2
- postgresql95-server
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /usr/local/pgsql/data
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"
pg_ver: 9.6
pg_ver: 9.5
pg_user: pgsql
pg_group: pgsql

View file

@ -1,17 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- postgresql11-server
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /var/db/postgres/data11
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"
pg_ver: 11
pg_user: postgres
pg_group: postgres
locale_latin_suffix: .ISO8859-1
locale_utf8_suffix: .UTF-8

View file

@ -5,7 +5,7 @@
postgresql_packages:
- postgresql11-server
- py27-psycopg2
- "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-psycopg2"
pg_dir: /var/db/postgres/data11
pg_hba_location: "{{ pg_dir }}/pg_hba.conf"

View file

@ -1,13 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql-server"
- "python3-psycopg2"
- "bzip2"
- "xz"
pg_hba_location: "/var/lib/pgsql/data/pg_hba.conf"
pg_dir: "/var/lib/pgsql/data"

View file

@ -5,8 +5,9 @@
postgresql_packages:
- "postgresql-server"
- "python-psycopg2"
- "python3-psycopg2"
- "bzip2"
- "xz"
pg_hba_location: "/var/lib/pgsql/data/pg_hba.conf"
pg_dir: "/var/lib/pgsql/data"

View file

@ -1,13 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql"
- "postgresql-common"
- "python-psycopg2"
pg_hba_location: "/etc/postgresql/9.1/main/pg_hba.conf"
pg_dir: "/var/lib/postgresql/9.1/main"
pg_ver: 9.1

View file

@ -1,13 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql"
- "postgresql-common"
- "python-psycopg2"
pg_hba_location: "/etc/postgresql/9.3/main/pg_hba.conf"
pg_dir: "/var/lib/postgresql/9.3/main"
pg_ver: 9.3

View file

@ -1,13 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql"
- "postgresql-common"
- "python3-psycopg2"
pg_hba_location: "/etc/postgresql/9.5/main/pg_hba.conf"
pg_dir: "/var/lib/postgresql/9.5/main"
pg_ver: 9.5

View file

@ -6,7 +6,7 @@
postgresql_packages:
- "postgresql"
- "postgresql-common"
- "python-psycopg2"
- "python3-psycopg2"
pg_hba_location: "/etc/postgresql/9.5/main/pg_hba.conf"
pg_dir: "/var/lib/postgresql/9.5/main"

View file

@ -1,11 +0,0 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
postgresql_packages:
- "postgresql-server"
- "python3-psycopg2"
pg_hba_location: "/var/lib/pgsql/data/pg_hba.conf"
pg_dir: "/var/lib/pgsql/data"

View file

@ -5,7 +5,7 @@
postgresql_packages:
- "postgresql-server"
- "python-psycopg2"
- "python3-psycopg2"
pg_hba_location: "/var/lib/pgsql/data/pg_hba.conf"
pg_dir: "/var/lib/pgsql/data"

View file

@ -2,30 +2,19 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
certifi < 2022.5.18 ; python_version < '3.5' # certifi 2022.5.18 requires Python 3.5 or later
cryptography >= 3.0, < 3.4 ; python_version < '3.6' # cryptography 3.4 drops support for python 2.7
cryptography >= 3.3, < 3.4 ; python_version < '3.9' # FIXME: the upper limit is needed for RHEL8.2, CentOS 8, Ubuntu 18.04, and OpenSuSE 15
deepdiff < 4.0.0 ; python_version < '3' # deepdiff 4.0.0 and later require python 3
pywinrm >= 0.3.0 # message encryption support
pycrypto >= 2.6 # Need features found in 2.6 and greater
ncclient >= 0.5.2 # Need features added in 0.5.2 and greater
python-nomad < 2.0.0 ; python_version <= '3.7' # python-nomad 2.0.0 needs Python 3.7+
ntlm-auth >= 1.3.0 # message encryption support using cryptography
requests < 2.28 ; python_version < '3.7' # requests 2.28.0 drops support for python 3.6 and before
requests-ntlm >= 1.1.0 # message encryption support
requests-credssp >= 0.1.0 # message encryption support
voluptuous >= 0.11.0 # Schema recursion via Self
openshift >= 0.6.2, < 0.9.0 # merge_type support
pyopenssl < 22.0.0 ; python_version < '3.6' # pyOpenSSL 22.0.0 and later require python 3.6 or later
pyfmg == 0.6.1 # newer versions do not pass current unit tests
mock >= 2.0.0 # needed for features backported from Python 3.6 unittest.mock (assert_called, assert_called_once...)
pytest-mock >= 1.4.0 # needed for mock_use_standalone_module pytest option
pyone == 1.1.9 # newer versions do not pass current integration tests
cffi >= 1.14.2, != 1.14.3 # Yanked version which older versions of pip will still install:
redis < 4.0.0 ; python_version < '3.6'
redis ; python_version >= '3.6'
pycdlib < 1.13.0 ; python_version < '3' # 1.13.0 does not work with Python 2, while not declaring that
python-daemon <= 2.3.0 ; python_version < '3'
bcrypt < 4.0.0 # TEMP: restrict to < 4.0.0 since installing 4.0.0 fails on RHEL 8
py-consul < 1.3.0 ; python_version < '3.8' # 1.3.0 dropped support for Python 3.5, 3.6, 3.7
py-consul < 1.5.4 ; python_version < '3.9' # 1.5.4 dropped support for Python 3.8