From 296669708f110d8a321d1c89ecc3e2afbf1a23c5 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Mon, 26 Aug 2024 20:01:51 +0200 Subject: [PATCH] Bump minimum Python and Ansible versions Running ansible-galaxy inside a tenks venv was failing on Ubuntu 22.04 with the following error: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY' Bump minimum Python and Ansible versions and switch from os_ironic module to openstack.cloud.baremetal_node. This drops support for Python versions below 3.9. The branch stable/2.0 can be used where Python 3.6 or 3.8 are required. Also drop centos8s and ubuntu-focal CI jobs which are only used in unmaintained branches. Change-Id: Ia740e9d8455fd9424378fa31b3495149db31c8e7 --- ansible/roles/ironic-enrolment/tasks/main.yml | 26 ----------------- ansible/roles/ironic-enrolment/tasks/node.yml | 27 ++++++++---------- requirements.txt | 2 +- setup.cfg | 6 ++-- tests/test_tenks_wait_for_resources.py | 4 ++- zuul.d/jobs.yaml | 28 ------------------- zuul.d/project.yaml | 14 ++-------- 7 files changed, 20 insertions(+), 87 deletions(-) diff --git a/ansible/roles/ironic-enrolment/tasks/main.yml b/ansible/roles/ironic-enrolment/tasks/main.yml index 659ec25..ed6517e 100644 --- a/ansible/roles/ironic-enrolment/tasks/main.yml +++ b/ansible/roles/ironic-enrolment/tasks/main.yml @@ -41,32 +41,6 @@ until: result is success retries: 3 -# If using clouds.yaml for authentication we need to pass in the ironic_url -# argument to the os_ironic module, due to a quirk in its implementation. -# Grab the endpoint from the file. -- name: Set ironic_url for os_ironic module - when: lookup('env', 'OS_CLOUD') | length > 0 - block: - - name: Query clouds.yaml - os_client_config: - clouds: "{{ lookup('env', 'OS_CLOUD') }}" - delegate_to: localhost - vars: - ansible_python_interpreter: >- - {{ lookup('env', 'VIRTUAL_ENV') | default('/usr', true) ~ '/bin/python' }} - - - name: Fail if the cloud was not found - fail: - msg: > - Cloud {{ lookup('env', 'OS_CLOUD') }} was not found in clouds.yaml - when: >- - openstack.clouds | length == 0 or - not openstack.clouds[0].get('auth', {}).get('endpoint') - - - name: Set a fact about the ironic API endpoint - set_fact: - ironic_url: "{{ openstack.clouds[0].auth.endpoint }}" - - name: Detect ironic API version command: >- {{ ironic_virtualenv_path }}/bin/openstack diff --git a/ansible/roles/ironic-enrolment/tasks/node.yml b/ansible/roles/ironic-enrolment/tasks/node.yml index 10194d2..254888b 100644 --- a/ansible/roles/ironic-enrolment/tasks/node.yml +++ b/ansible/roles/ironic-enrolment/tasks/node.yml @@ -40,21 +40,18 @@ when: (node.state | default('present')) == 'present' - name: Configure node in Ironic - os_ironic: + openstack.cloud.baremetal_node: auth_type: "{{ 'password' if lookup('env', 'OS_USERNAME') else omit }}" cloud: "{{ lookup('env', 'OS_CLOUD') | default(omit, true) }}" - ironic_url: "{{ ironic_url | default(omit) }}" driver: "{{ node.ironic_driver }}" driver_info: - power: - ipmi_address: "{{ hostvars[ironic_hypervisor].ipmi_address }}" - # This is passed in from main.yml. - ipmi_port: "{{ ipmi_port }}" - ipmi_username: "{{ hostvars[ironic_hypervisor].ipmi_username }}" - ipmi_password: "{{ hostvars[ironic_hypervisor].ipmi_password }}" - deploy: - deploy_kernel: "{{ ironic_deploy_kernel_uuid | default(omit, true) }}" - deploy_ramdisk: "{{ ironic_deploy_ramdisk_uuid | default(omit, true) }}" + ipmi_address: "{{ hostvars[ironic_hypervisor].ipmi_address }}" + # This is passed in from main.yml. + ipmi_port: "{{ ipmi_port }}" + ipmi_username: "{{ hostvars[ironic_hypervisor].ipmi_username }}" + ipmi_password: "{{ hostvars[ironic_hypervisor].ipmi_password }}" + deploy_kernel: "{{ ironic_deploy_kernel_uuid | default(omit, true) }}" + deploy_ramdisk: "{{ ironic_deploy_ramdisk_uuid | default(omit, true) }}" name: "{{ node.name }}" # The 'nics' list can be empty without a problem if state is 'absent'. nics: "{{ nics | default([]) }}" # noqa args[module] @@ -75,13 +72,13 @@ - name: Put Ironic node into maintenance mode command: >- '{{ ironic_virtualenv_path }}/bin/openstack' baremetal node maintenance set - '{{ node_res.uuid }}' + '{{ node_res.node.id }}' changed_when: true - name: Set additional Ironic node attributes command: >- '{{ ironic_virtualenv_path }}/bin/openstack' baremetal node set - '{{ node_res.uuid }}' + '{{ node_res.node.id }}' --resource-class {{ node.ironic_config.resource_class }} {% for iface in ironic_interfaces %} {% if (iface + '_interface') in node.ironic_config %} @@ -113,7 +110,7 @@ - name: Add Ironic node traits command: >- '{{ ironic_virtualenv_path }}/bin/openstack' baremetal node add trait - '{{ node_res.uuid }}' + '{{ node_res.node.id }}' {{ " ".join(node.ironic_config.traits) }} changed_when: true when: node.ironic_config.traits | default([]) @@ -131,5 +128,5 @@ - name: Bring Ironic node out of maintenance mode command: >- '{{ ironic_virtualenv_path }}/bin/openstack' baremetal node maintenance - unset '{{ node_res.uuid }}' + unset '{{ node_res.node.id }}' changed_when: true diff --git a/requirements.txt b/requirements.txt index 7b2f0dd..22d80a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ # process, which may cause wedges in the gate later. pbr>=2.0 # Apache-2.0 -ansible>=2.7.0,<6.0 # GPLv3 +ansible>=8,<9 # GPLv3 os-client-config # Apache-2.0 selinux # MIT diff --git a/setup.cfg b/setup.cfg index 3cf1397..4da8563 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ description_file = author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/tenks/latest/ -python_requires = >=3.6 +python_requires = >=3.9 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -17,11 +17,9 @@ classifier = Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [files] packages = diff --git a/tests/test_tenks_wait_for_resources.py b/tests/test_tenks_wait_for_resources.py index b9a8851..2a85212 100644 --- a/tests/test_tenks_wait_for_resources.py +++ b/tests/test_tenks_wait_for_resources.py @@ -268,7 +268,9 @@ inventory_resource_class_reserved = chain( # scenario - same resource class, different traits - success # Arbitrary subset -resource_provider_traits_subset = random.sample(resource_provider_traits, 3) +resource_provider_traits_subset = random.sample( + sorted(resource_provider_traits), 3 +) resource_provider_traits_subset_out = traits_to_json( resource_provider_traits_subset diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index e09e47f..5a603f9 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -13,15 +13,6 @@ - ^tests/ - ^zuul\.d/ -- job: - name: tenks-deploy-teardown-ovs-bios-centos8s - parent: tenks-deploy-teardown-ovs-bios-base - nodeset: centos-8-stream - required-projects: - # NOTE(mgoddard): CentOS 8 uses Python 3.6 which is not supported in Zed. - - name: openstack/requirements - override-checkout: stable/yoga - - job: name: tenks-deploy-teardown-ovs-bios-centos9s parent: tenks-deploy-teardown-ovs-bios-base @@ -37,25 +28,11 @@ parent: tenks-deploy-teardown-ovs-bios-base nodeset: rockylinux-9 -- job: - name: tenks-deploy-teardown-ovs-bios-ubuntu-focal - parent: tenks-deploy-teardown-ovs-bios-base - nodeset: ubuntu-focal - - job: name: tenks-deploy-teardown-ovs-bios-ubuntu-jammy parent: tenks-deploy-teardown-ovs-bios-base nodeset: ubuntu-jammy -- job: - name: tenks-deploy-teardown-linuxbridge-uefi-centos8s - parent: tenks-deploy-teardown-linuxbridge-uefi-base - nodeset: centos-8-stream - required-projects: - # NOTE(mgoddard): CentOS 8 uses Python 3.6 which is not supported in Zed. - - name: openstack/requirements - override-checkout: stable/yoga - - job: name: tenks-deploy-teardown-linuxbridge-uefi-centos9s parent: tenks-deploy-teardown-linuxbridge-uefi-base @@ -71,11 +48,6 @@ parent: tenks-deploy-teardown-linuxbridge-uefi-base nodeset: rockylinux-9 -- job: - name: tenks-deploy-teardown-linuxbridge-uefi-ubuntu-focal - parent: tenks-deploy-teardown-linuxbridge-uefi-base - nodeset: ubuntu-focal - - job: name: tenks-deploy-teardown-linuxbridge-uefi-ubuntu-jammy parent: tenks-deploy-teardown-linuxbridge-uefi-base diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 7e3335b..1487048 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -8,22 +8,17 @@ check: jobs: - openstack-tox-pep8 - - openstack-tox-py36 - - openstack-tox-py38 - openstack-tox-py39 - openstack-tox-py310 + - openstack-tox-py311 - tenks-tox-ansible-lint - - tenks-deploy-teardown-ovs-bios-centos8s - tenks-deploy-teardown-ovs-bios-centos9s - tenks-deploy-teardown-ovs-bios-debian-bullseye - tenks-deploy-teardown-ovs-bios-rocky-9 - - tenks-deploy-teardown-ovs-bios-ubuntu-focal - tenks-deploy-teardown-ovs-bios-ubuntu-jammy - - tenks-deploy-teardown-linuxbridge-uefi-centos8s - tenks-deploy-teardown-linuxbridge-uefi-centos9s - tenks-deploy-teardown-linuxbridge-uefi-debian-bullseye - tenks-deploy-teardown-linuxbridge-uefi-rocky-9 - - tenks-deploy-teardown-linuxbridge-uefi-ubuntu-focal - tenks-deploy-teardown-linuxbridge-uefi-ubuntu-jammy # Until we have ironic jobs using tenks, gate on the kayobe overcloud # deploy job, which uses tenks to test bare metal compute provisioning. @@ -33,22 +28,17 @@ gate: jobs: - openstack-tox-pep8 - - openstack-tox-py36 - - openstack-tox-py38 - openstack-tox-py39 - openstack-tox-py310 + - openstack-tox-py311 - tenks-tox-ansible-lint - - tenks-deploy-teardown-ovs-bios-centos8s - tenks-deploy-teardown-ovs-bios-centos9s - tenks-deploy-teardown-ovs-bios-debian-bullseye - tenks-deploy-teardown-ovs-bios-rocky-9 - - tenks-deploy-teardown-ovs-bios-ubuntu-focal - tenks-deploy-teardown-ovs-bios-ubuntu-jammy - - tenks-deploy-teardown-linuxbridge-uefi-centos8s - tenks-deploy-teardown-linuxbridge-uefi-centos9s - tenks-deploy-teardown-linuxbridge-uefi-debian-bullseye - tenks-deploy-teardown-linuxbridge-uefi-rocky-9 - - tenks-deploy-teardown-linuxbridge-uefi-ubuntu-focal - tenks-deploy-teardown-linuxbridge-uefi-ubuntu-jammy # Until we have ironic jobs using tenks, gate on the kayobe overcloud # deploy job, which uses tenks to test bare metal compute provisioning.