diff --git a/.zuul.yaml b/.zuul.yaml index 576682dc..a907e250 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -212,17 +212,42 @@ branches: master description: | Run openstack collections functional tests against a master devstack - using master of openstacksdk and stable 2.16 branch of ansible + using master of openstacksdk and stable 2.18 branch of ansible required-projects: - name: github.com/ansible/ansible override-checkout: stable-2.18 vars: tox_envlist: ansible_2_18 +- job: + name: ansible-collections-openstack-functional-devstack-ansible-2.19 + parent: ansible-collections-openstack-functional-devstack-base + branches: master + description: | + Run openstack collections functional tests against a master devstack + using master of openstacksdk and stable 2.19 branch of ansible + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.19 + vars: + tox_envlist: ansible_2_19 + +- job: + name: ansible-collections-openstack-functional-devstack-ansible-2.20 + parent: ansible-collections-openstack-functional-devstack-base + branches: master + description: | + Run openstack collections functional tests against a master devstack + using master of openstacksdk and stable 2.20 branch of ansible + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.20 + vars: + tox_envlist: ansible_2_20 + - job: name: ansible-collections-openstack-functional-devstack-ansible-devel parent: ansible-collections-openstack-functional-devstack-base - nodeset: openstack-single-node-jammy branches: master description: | Run openstack collections functional tests against a master devstack @@ -251,13 +276,13 @@ - job: name: openstack-tox-linters-ansible-devel parent: openstack-tox-linters-ansible - nodeset: ubuntu-jammy + nodeset: ubuntu-noble description: | Run openstack collections linter tests using the devel branch of ansible # non-voting because we can't prevent ansible devel from breaking us voting: false vars: - python_version: '3.10' + python_version: '3.12' bindep_profile: test py310 - job: @@ -273,10 +298,36 @@ python_version: "3.12" bindep_profile: test py312 +- job: + name: openstack-tox-linters-ansible-2.19 + parent: openstack-tox-linters-ansible + description: | + Run openstack collections linter tests using the 2.19 branch of ansible + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.19 + vars: + tox_envlist: linters_2_19 + python_version: "3.12" + bindep_profile: test py312 + +- job: + name: openstack-tox-linters-ansible-2.20 + parent: openstack-tox-linters-ansible + description: | + Run openstack collections linter tests using the 2.20 branch of ansible + required-projects: + - name: github.com/ansible/ansible + override-checkout: stable-2.20 + vars: + tox_envlist: linters_2_20 + python_version: "3.12" + bindep_profile: test py312 + # Cross-checks with other projects - job: name: bifrost-collections-src - parent: bifrost-integration-on-ubuntu-jammy + parent: bifrost-integration-on-ubuntu-noble required-projects: - openstack/ansible-collections-openstack - # always use master branch when collecting parent job variants, refer to git blame for rationale. @@ -287,7 +338,7 @@ override-checkout: master - job: name: bifrost-keystone-collections-src - parent: bifrost-integration-keystone-on-ubuntu-jammy + parent: bifrost-integration-keystone-on-ubuntu-noble required-projects: - openstack/ansible-collections-openstack - # always use master branch when collecting parent job variants, refer to git blame for rationale. @@ -326,9 +377,13 @@ - tox-pep8 - openstack-tox-linters-ansible-devel - openstack-tox-linters-ansible-2.18 + - openstack-tox-linters-ansible-2.19 + - openstack-tox-linters-ansible-2.20 - ansible-collections-openstack-functional-devstack - ansible-collections-openstack-functional-devstack-releases - ansible-collections-openstack-functional-devstack-ansible-2.18 + - ansible-collections-openstack-functional-devstack-ansible-2.19 + - ansible-collections-openstack-functional-devstack-ansible-2.20 - ansible-collections-openstack-functional-devstack-ansible-devel - ansible-collections-openstack-functional-devstack-magnum - ansible-collections-openstack-functional-devstack-manila @@ -345,6 +400,8 @@ jobs: - tox-pep8 - openstack-tox-linters-ansible-2.18 + - openstack-tox-linters-ansible-2.19 + - openstack-tox-linters-ansible-2.20 - ansible-collections-openstack-functional-devstack-releases - ansible-collections-openstack-functional-devstack-magnum - ansible-collections-openstack-functional-devstack-manila @@ -354,9 +411,13 @@ jobs: - openstack-tox-linters-ansible-devel - openstack-tox-linters-ansible-2.18 + - openstack-tox-linters-ansible-2.19 + - openstack-tox-linters-ansible-2.20 - ansible-collections-openstack-functional-devstack - ansible-collections-openstack-functional-devstack-releases - ansible-collections-openstack-functional-devstack-ansible-2.18 + - ansible-collections-openstack-functional-devstack-ansible-2.19 + - ansible-collections-openstack-functional-devstack-ansible-2.20 - ansible-collections-openstack-functional-devstack-ansible-devel - bifrost-collections-src - bifrost-keystone-collections-src diff --git a/plugins/module_utils/openstack.py b/plugins/module_utils/openstack.py index 72908d5d..827b4fb7 100644 --- a/plugins/module_utils/openstack.py +++ b/plugins/module_utils/openstack.py @@ -32,16 +32,15 @@ import abc import copy -from ansible.module_utils.six import raise_from try: from ansible.module_utils.compat.version import StrictVersion except ImportError: try: from distutils.version import StrictVersion except ImportError as exc: - raise_from(ImportError('To use this plugin or module with ansible-core' - ' < 2.11, you need to use Python < 3.12 with ' - 'distutils.version present'), exc) + raise ImportError(f'To use this plugin or module with ansible-core' + f' < 2.11, you need to use Python < 3.12 with ' + f'distutils.version present. {exc}') import importlib import os diff --git a/tests/requirements-ansible-2.19.txt b/tests/requirements-ansible-2.19.txt new file mode 100644 index 00000000..246567de --- /dev/null +++ b/tests/requirements-ansible-2.19.txt @@ -0,0 +1,12 @@ +ansible-core>=2.19.0,<2.20.0 +flake8 +galaxy-importer +openstacksdk +pycodestyle +pylint +rstcheck +ruamel.yaml +tox +voluptuous +yamllint +setuptools diff --git a/tests/requirements-ansible-2.20.txt b/tests/requirements-ansible-2.20.txt new file mode 100644 index 00000000..0556ba92 --- /dev/null +++ b/tests/requirements-ansible-2.20.txt @@ -0,0 +1,12 @@ +ansible-core>=2.20.0,<2.21.0 +flake8 +galaxy-importer +openstacksdk +pycodestyle +pylint +rstcheck +ruamel.yaml +tox +voluptuous +yamllint +setuptools diff --git a/tox.ini b/tox.ini index e714bc32..1e8a1614 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ commands = ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact bash {toxinidir}/tools/check-import.sh {toxinidir} -[testenv:linters_{2_9,2_11,2_12,2_16,2_18,latest}] +[testenv:linters_{2_18,2_19,2_20,latest}] allowlist_externals = bash commands = {[testenv:build]commands} @@ -52,11 +52,9 @@ deps = -c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt} {[testenv:build]deps} linters_latest: -r{toxinidir}/tests/requirements.txt - linters_2_9: -r{toxinidir}/tests/requirements-ansible-2.9.txt - linters_2_11: -r{toxinidir}/tests/requirements-ansible-2.11.txt - linters_2_12: -r{toxinidir}/tests/requirements-ansible-2.12.txt - linters_2_16: -r{toxinidir}/tests/requirements-ansible-2.16.txt linters_2_18: -r{toxinidir}/tests/requirements-ansible-2.18.txt + linters_2_19: -r{toxinidir}/tests/requirements-ansible-2.19.txt + linters_2_20: -r{toxinidir}/tests/requirements-ansible-2.20.txt passenv = * [flake8] @@ -70,18 +68,16 @@ ignore = W503,H4,E501,E402,H301 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible_collections -[testenv:ansible_{2_9,2_11,2_12,2_16,2_18,latest}] +[testenv:ansible_{2_18,2_19,2_20,latest}] allowlist_externals = bash commands = bash {toxinidir}/ci/run-ansible-tests-collection.sh -e {envdir} {posargs} deps = -c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt} ansible_latest: -r{toxinidir}/tests/requirements.txt - ansible_2_9: -r{toxinidir}/tests/requirements-ansible-2.9.txt - ansible_2_11: -r{toxinidir}/tests/requirements-ansible-2.11.txt - ansible_2_12: -r{toxinidir}/tests/requirements-ansible-2.12.txt - ansible_2_16: -r{toxinidir}/tests/requirements-ansible-2.16.txt ansible_2_18: -r{toxinidir}/tests/requirements-ansible-2.18.txt + ansible_2_19: -r{toxinidir}/tests/requirements-ansible-2.19.txt + ansible_2_20: -r{toxinidir}/tests/requirements-ansible-2.20.txt # Need to pass some env vars for the Ansible playbooks passenv = HOME