Changeset - ea2565a624f1
[Not reviewed]
0 7 0
Branko Majic (branko) - 2 months ago 2024-02-11 23:19:38
branko@majic.rs
MAR-154: Update documentation and test site for Python 2.7 support removal:

- Drop most of the references to Python 2.
- Switch anything that has been previously using Python 2.7 to Python
3.
7 files changed with 14 insertions and 28 deletions:
0 comments (0 inline, 0 general)
docs/development.rst
Show inline comments
 
@@ -199,9 +199,9 @@ WSGI applications deployed via roles:
 

	
 
- ``phpinfo``, used to serve information about the local PHP
 
  installation.
 
- ``wsgihello``, small hello world application using Python 2
 
- ``wsgihello2``, small hello world application using Python 3 and a
 
  couple of additional ``wsgi_website`` role parameters.
 
- ``wsgihello``, small hello world application.
 
- ``wsgihello2``, small hello world application using a couple of
 
  additional ``wsgi_website`` role parameters.
 

	
 
To make the web applications reachable, make sure the web server
 
(``web.example.com``) IP is also resolvable via names:
docs/rolereference.rst
Show inline comments
 
@@ -1746,10 +1746,7 @@ The role implements the following:
 
* Adds website administrator to website's group, so administrator could manage
 
  the code and data.
 
* Installs additional packages required for running the role (as configured).
 
* Sets-up a dedicated Python virtual environment for website. Python
 
  version can be specified (default is Python 2).
 
* Install ``futures`` package in Python virtual environment (required for
 
  Gunicorn in combination with Python 2.7).
 
* Sets-up a dedicated Python virtual environment for website.
 
* Install Gunicorn in Python virtual environment.
 
* Installs additional packages required for running the role in Python virtual
 
  environment (as configured).
 
@@ -1919,13 +1916,11 @@ Parameters
 
  noted that in either case the value should be specsified relative to the
 
  ``code`` sub-directory. I.e. don't use full paths.
 

	
 
**wsgi_requirements** (list, optional, ``[ futures==3.3.0, gunicorn==19.10.0 ]``)
 
**wsgi_requirements** (list, optional, ``[ gunicorn==21.2.0, packaging==23.2 ]``)
 
  Complete list of pip requirements used for deploying Gunicorn. If
 
  specified, this list will be used to create requirements file and
 
  install Gunicorn and its dependencies from that one. This allows to
 
  have pinned packages for both Gunicorn, futures, and their
 
  dependencies. The ``futures`` package is required by Gunicorn when
 
  using Python 2.7.
 
  have pinned packages for both Gunicorn and its dependencies.
 

	
 
  It should be noted that this installation method is meant primarily in case of
 
  roles that want to take advantage of upgrade checks for pip requirements
 
@@ -1935,10 +1930,9 @@ Parameters
 
  specified the role will deploy necessary files for running the pip
 
  requirements upgrade check (see the ``common`` role for
 
  description). For this a directory is created under
 
  ``/etc/pip_check_requirements_upgrades/FQDN`` for Python 2 or
 
  ``/etc/pip_check_requirements_upgrades-py3/FQDN`` for Python 3. The same
 
  directory should be used by dependant roles to deploy their own
 
  ``.in`` and ``.txt`` files. Make sure the file ownership is set to
 
  ``/etc/pip_check_requirements_upgrades/FQDN``. The same directory
 
  should be used by dependant roles to deploy their own ``.in`` and
 
  ``.txt`` files. Make sure the file ownership is set to
 
  ``root:pipreqcheck``.
 

	
 
  Should you need to utilise the requirements file in some manner (other than
 
@@ -1950,12 +1944,10 @@ Parameters
 
  <https://github.com/jazzband/pip-tools>`_ (the ``pip-compile`` utility) with
 
  ``gunicorn`` and ``futures`` in the ``.in.`` file.
 

	
 
**wsgi_requirements_in** (list, optional, ``[ futures, gunicorn ]``)
 
**wsgi_requirements_in** (list, optional, ``[ gunicorn ]``)
 
  List of top level packages to use when performing the pip
 
  requirements upgrade checks for the Gunicorn requirements (listed
 
  via ``wsgi_requirements`` parameter). For Python 3-based websites,
 
  it should be sufficient to list only ``gunicorn`` (``futures`` is
 
  required for Python 2).
 
  via ``wsgi_requirements`` parameter).
 

	
 

	
 
Distribution compatibility
docs/usage.rst
Show inline comments
 
@@ -1871,8 +1871,6 @@ on the safe side:
 
            - libpng-dev
 
            - libmariadb-dev
 
            - libmariadb-dev-compat
 
          # Specify that Python 3 should be used for the application
 
          python_version: 3
 
          # Here we specify that anything accessing our website with "/static/"
 
          # URL should be treated as request to a static file, to be served
 
          # directly by Nginx instead of the WSGI server.
roles/common/molecule/default/tests/test_default.py
Show inline comments
 
@@ -326,8 +326,7 @@ def test_pipreqcheck_virtualenv_packages(host):
 
    actual_packages = sorted(packages.stdout.lower().strip().split("\n"))
 

	
 
    # This is a dummy distro-provided package ignored by the
 
    # pip-tools. pkg-resources for Python 2.7, pkg_resources for
 
    # Python 3.
 
    # pip-tools. Two variants of this name have been previously known.
 
    if "pkg-resources==0.0.0" in actual_packages:
 
        actual_packages.remove("pkg-resources==0.0.0")
 
    if "pkg_resources==0.0.0" in actual_packages:
roles/wsgi_website/molecule/default/tests/test_default.py
Show inline comments
 
@@ -512,9 +512,7 @@ def test_python_version_in_virtualenv(host, python_path, expected_version):
 

	
 
        assert python_version.rc == 0
 

	
 
        # Python 2 outputs version to stderr, Python 3 outputs it to
 
        # stdout. Go figure.
 
        assert expected_version in python_version.stdout or expected_version in python_version.stderr
 
        assert expected_version in python_version.stdout
 

	
 

	
 
@pytest.mark.parametrize("fqdn, pip_check_requirements_upgrades_directory, expected_requirements_in, expected_requirements", [
testsite/playbooks/roles/wsgihello2/meta/main.yml
Show inline comments
 
@@ -16,7 +16,6 @@ dependencies:
 
      - gunicorn==19.9.0
 
    wsgi_requirements_in:
 
      - gunicorn
 
    python_version: 3
 
  - role: database
 
    db_name: wsgi_{{ testsite_domain_underscores }}
 
    db_password: wsgi_{{ testsite_domain_underscores }}
testsite/playbooks/roles/wsgihello2/tasks/main.yml
Show inline comments
 
@@ -5,7 +5,7 @@
 
        owner="admin-wsgireq_{{ testsite_domain_underscores }}" group="web-wsgireq_{{ testsite_domain_underscores }}" mode=2750
 

	
 
- name: Deploy requirements and its source for upgrade checks
 
  copy: src="{{ item }}" dest="/etc/pip_check_requirements_upgrades-py3/wsgireq.{{ testsite_domain }}/{{ item }}"
 
  copy: src="{{ item }}" dest="/etc/pip_check_requirements_upgrades/wsgireq.{{ testsite_domain }}/{{ item }}"
 
        owner="root" group="pipreqcheck" mode=640
 
  with_items:
 
    - requirements.in
0 comments (0 inline, 0 general)