diff --git a/docs/releasenotes.rst b/docs/releasenotes.rst index 099233c19915a06a84fe015a2a40b63fe23ba917..8b4926be3d6a76923f532886c8de2eb2a9bde38d 100644 --- a/docs/releasenotes.rst +++ b/docs/releasenotes.rst @@ -27,6 +27,18 @@ Dropped support for Debian 10 (Buster). renamed to ``pip_check_requirements`` / ``pip_check_requirements_in``. +* ``wsgi_website`` role + + * Dropped support for Python 2.7. Only Python 3 is supported now. + + The ``python_version`` role parameter has been dropped. The + ``python_interpreter`` parameter is still available, but it + defaults to Python 3 binary. + + Python (input) requirements files are now placed under the + ``/etc/pip_check_requirements_upgrades`` path, in accordance to + changes made in this release to the ``common`` role. + **Bug fixes:** * ``common`` role diff --git a/docs/rolereference.rst b/docs/rolereference.rst index 03e197ef3c2488b552fe9cef69655de766108db0..905aa79538185a0b5111afdb89fcc2395f994de4 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -1882,9 +1882,6 @@ Parameters forget to surround them by another set of quotes for YAML syntax, for example ``"\"\""`` or ``'""'``). -**python_version** (string, optional, ``2``) - Python version to use when setting-up the Python virtual environment. - **rewrites** (list, optional, ``[]``) A list of rewrite rules that are applied to incoming requests. Each element of the list should be a string value compatible with the format of ``nginx`` diff --git a/roles/wsgi_website/defaults/main.yml b/roles/wsgi_website/defaults/main.yml index 5a0ff237a7941907a64cb7777e1cdd680e17205d..6f0dde64f6a285192bc45178506596c4da2bdff6 100644 --- a/roles/wsgi_website/defaults/main.yml +++ b/roles/wsgi_website/defaults/main.yml @@ -10,17 +10,15 @@ environment_variables: {} website_mail_recipients: "root" environment_indicator: null proxy_headers: {} -python_version: 2 wsgi_requirements: - - futures==3.3.0 - - gunicorn==19.10.0 + - gunicorn==21.2.0 + - packaging==23.2 wsgi_requirements_in: - - futures - gunicorn # Internal parameters. admin: "admin-{{ fqdn | replace('.', '_') }}" user: "web-{{ fqdn | replace('.', '_') }}" home: "/var/www/{{ fqdn }}" -python_interpreter: "/usr/bin/python{{ python_version }}" -pip_check_requirements_upgrades_directory: "/etc/pip_check_requirements_upgrades{% if python_version | int == 3 %}-py3{% endif %}" +python_interpreter: "/usr/bin/python3" +pip_check_requirements_upgrades_directory: "/etc/pip_check_requirements_upgrades" diff --git a/roles/wsgi_website/molecule/default/playbook.yml b/roles/wsgi_website/molecule/default/playbook.yml index 050eb3cff86c503f7683717b46409c77366abc31..6d88a71b30e2a450be7e3b122d3c01da60f5e377 100644 --- a/roles/wsgi_website/molecule/default/playbook.yml +++ b/roles/wsgi_website/molecule/default/playbook.yml @@ -60,11 +60,10 @@ website_mail_recipients: user wsgi_application: testapp:application wsgi_requirements: - - futures==3.1.1 - - gunicorn==20.0.4 + - gunicorn==21.1.0 + - packaging==23.2 wsgi_requirements_in: - gunicorn - python_version: 3 - role: wsgi_website fqdn: parameters-paste-req @@ -82,8 +81,8 @@ - Werkzeug==0.12.2 wsgi_application: config.ini wsgi_requirements: - - futures==3.1.1 - - gunicorn==19.8.1 + - gunicorn==21.1.0 + - packaging==23.2 https_tls_certificate: "{{ lookup('file', 'tests/data/x509/server/parameters-paste-req_https.cert.pem') }}" https_tls_key: "{{ lookup('file', 'tests/data/x509/server/parameters-paste-req_https.key.pem') }}" diff --git a/roles/wsgi_website/molecule/default/tests/test_default.py b/roles/wsgi_website/molecule/default/tests/test_default.py index f3472421c998c5df9258710cc176f015cd9b8034..6c3c77eef198ee85b80a568dc099c6268551e1b3 100644 --- a/roles/wsgi_website/molecule/default/tests/test_default.py +++ b/roles/wsgi_website/molecule/default/tests/test_default.py @@ -273,16 +273,16 @@ def test_python_virtualenv_wrapper_script(host, wrapper_script, expected_owner, @pytest.mark.parametrize("admin_user, pip_path, expected_packages", [ ('admin-parameters-mandatory', '/var/www/parameters-mandatory/virtualenv/bin/pip', [ - "futures==3.3.0", - "gunicorn==19.10.0", + "gunicorn==21.2.0", + "packaging==23.2", ]), ('admin-parameters-optional_local', '/var/www/parameters-optional.local/virtualenv/bin/pip', [ "Pygments==2.2.0", "dnspython==1.15.0", "docopt==0.6.2", - "futures==3.1.1", - "gunicorn==20.0.4", + "gunicorn==21.1.0", "jedi==0.13.1", + "packaging==23.2", "parso==0.3.1", "prompt-toolkit==1.0.15", "ptpython==0.41", @@ -298,9 +298,9 @@ def test_python_virtualenv_wrapper_script(host, wrapper_script, expected_owner, "PasteScript==2.0.2", "Werkzeug==0.12.2", "click==6.7", - "futures==3.1.1", - "gunicorn==19.8.1", + "gunicorn==21.1.0", "itsdangerous==0.24", + "packaging==23.2", "six==1.10.0", ]), ]) @@ -496,9 +496,9 @@ def test_website_enabled(host, config_file, expected_content): @pytest.mark.parametrize("python_path, expected_version", [ - ("/var/www/parameters-mandatory/virtualenv/bin/python", "Python 2"), + ("/var/www/parameters-mandatory/virtualenv/bin/python", "Python 3"), ("/var/www/parameters-optional.local/virtualenv/bin/python", "Python 3"), - ("/var/www/parameters-paste-req/virtualenv/bin/python", "Python 2"), + ("/var/www/parameters-paste-req/virtualenv/bin/python", "Python 3"), ]) def test_python_version_in_virtualenv(host, python_path, expected_version): """ @@ -518,9 +518,9 @@ def test_python_version_in_virtualenv(host, python_path, expected_version): @pytest.mark.parametrize("fqdn, pip_check_requirements_upgrades_directory, expected_requirements_in, expected_requirements", [ - ("parameters-mandatory", "/etc/pip_check_requirements_upgrades", ["futures", "gunicorn"], ["futures==3.3.0", "gunicorn==19.10.0"]), - ("parameters-optional.local", "/etc/pip_check_requirements_upgrades-py3", ["gunicorn"], ["futures==3.1.1", "gunicorn==20.0.4"]), - ("parameters-paste-req", "/etc/pip_check_requirements_upgrades", ["futures", "gunicorn"], ["futures==3.1.1", "gunicorn==19.8.1"]), + ("parameters-mandatory", "/etc/pip_check_requirements_upgrades", ["gunicorn"], ["gunicorn==21.2.0", "packaging==23.2"]), + ("parameters-optional.local", "/etc/pip_check_requirements_upgrades", ["gunicorn"], ["gunicorn==21.1.0", "packaging==23.2"]), + ("parameters-paste-req", "/etc/pip_check_requirements_upgrades", ["gunicorn"], ["gunicorn==21.1.0", "packaging==23.2"]), ]) def test_wsgi_requirements(host, fqdn, pip_check_requirements_upgrades_directory, expected_requirements_in, expected_requirements): """ diff --git a/roles/wsgi_website/molecule/default/tests/test_parameters_mandatory.py b/roles/wsgi_website/molecule/default/tests/test_parameters_mandatory.py index 9f8af8b4fcf0c275b6398951ef75316c810b1d38..10d53776963b76561b70c5fd57f23fcbacc05ca1 100644 --- a/roles/wsgi_website/molecule/default/tests/test_parameters_mandatory.py +++ b/roles/wsgi_website/molecule/default/tests/test_parameters_mandatory.py @@ -23,7 +23,7 @@ def test_index_page(host): assert "Requested URL was: https://parameters-mandatory/" in page.stdout assert "MY_ENV_VAR: None" in page.stdout assert "Accept-Encoding: plain" in page.stdout - assert "Python version: 2." in page.stdout + assert "Python version: 3." in page.stdout def test_static_file_serving(host): diff --git a/roles/wsgi_website/molecule/default/tests/test_parameters_paste_req.py b/roles/wsgi_website/molecule/default/tests/test_parameters_paste_req.py index f8f69f25815964b3727136ce7137772616554cd1..8e00d2ce1db94b1e446453e6d3525ff96fd6c085 100644 --- a/roles/wsgi_website/molecule/default/tests/test_parameters_paste_req.py +++ b/roles/wsgi_website/molecule/default/tests/test_parameters_paste_req.py @@ -23,7 +23,7 @@ def test_index_page(host): assert "Requested URL was: https://parameters-paste-req/" in page.stdout assert "MY_ENV_VAR: None" in page.stdout assert "Accept-Encoding: plain" in page.stdout - assert "Python version: 2." in page.stdout + assert "Python version: 3." in page.stdout def test_static_file_serving(host): diff --git a/roles/wsgi_website/tasks/main.yml b/roles/wsgi_website/tasks/main.yml index 4f07bcaa56431d3bda4fd3c7e1c4feadc958e0ea..1510ce6f6e601c20449c1184c76e138e91da2510 100644 --- a/roles/wsgi_website/tasks/main.yml +++ b/roles/wsgi_website/tasks/main.yml @@ -94,7 +94,7 @@ file: path: "{{ home }}/virtualenv" state: absent - when: "current_python_version.rc == 0 and not current_python_version.stdout.startswith(python_version | string)" + when: "current_python_version.rc == 0 and not current_python_version.stdout.startswith('3')" notify: - Restart WSGI services