From 180d7b99f777746173d1c0155e27602d5cda712d 2019-08-25 19:36:20 From: Branko Majic Date: 2019-08-25 19:36:20 Subject: [PATCH] MAR-146: Added separate parameter for Pyhton 3 virtual environment used for upgrade checks: - Release notes updated to mention the breaking change. - Updated role reference documentation to cover the new parameter. - Updated default values for the dedicated Python virtual environments. - Update role common to deploy separate requirements for the two environments. - Include wheel package in the requirements. --- diff --git a/docs/releasenotes.rst b/docs/releasenotes.rst index 65500a572c5ca20e8173d2f198826a2dbb3b3cfe..05577bb3591af95ef131707ec7defadad3dd500d 100644 --- a/docs/releasenotes.rst +++ b/docs/releasenotes.rst @@ -5,6 +5,20 @@ Release notes NEXT RELEASE ------------ +Breaking changes: + +* ``common`` role: + + * Added separate parameter (``pip_check_requirements_py3``) for + specifying dedicated Python 3 virtual environment package + requirements used for package upgrade checks on (other + user-provided) Python 3 virtual environments. If the existing + ``pip_check_requirements`` parameter has been overridden, the new + parameter will most likely need to be overridden in your site + configuration as well. Take note that the new requirements will + differ between Debian Jessie and Debian Stretch due to differnece + in Python 3 minor version releases. + Bug fixes: * ``backup_client`` role diff --git a/docs/rolereference.rst b/docs/rolereference.rst index 448aa0bd1900c78485d0fc1a6cc95df27bc86b57..f8ee12ec4defba9fdabbc2e2ef9a1922163789cf 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -421,12 +421,29 @@ Parameters - "2.debian.pool.ntp.org" - "3.debian.pool.ntp.org" -**pip_check_requirements** (list, optional, ``[click==7.0, pip-tools==3.1.0, pip==18.1, setuptools==40.6.2, six==1.11.0, wheel==0.32.3]``) - List of Python package requirements to install in Python 2 and - Python 3 virtual environments in order to be able to run the - ``pip-tools`` applications as part of pip requirements upgrade - checks. This list needs to be updated from time to time as the new - releases of ``pip-tools`` and related packages are coming out. +**pip_check_requirements** (list, optional, ``[click==7.0, pip-tools==4.0.0, pip==19.2.3, setuptools==41.2.0, six==1.12.0, wheel==0.33.6]``) + List of Python package requirements to install in Python 2 virtual + environment in order to be able to run the ``pip-tools`` + applications as part of pip requirements upgrade checks. This list + needs to be updated from time to time as the new releases of + ``pip-tools`` and related packages are coming out. For Python 3, see + the dedicatd parameter ``pip_check_requirements_py3`` below. + +**pip_check_requirements_py3** (list, optional, ``[click==7.0, pip-tools==3.9.0, pip==19.1.1, setuptools==41.2.0, six==1.12.0, wheel==0.33.6]``) + List of Python package requirements to install in Python 3 virtual + environment in order to be able to run the ``pip-tools`` + applications as part of pip requirements upgrade checks. This list + needs to be updated from time to time as the new releases of + ``pip-tools`` and related packages are coming out. For Python 2, see + the dedicatd parameter ``pip_check_requirements`` above. + + Take note that on Debian Jessie and Stretch there will be + differences in what the system uses because of differing Python 3 + versions and deprecation around Python 3 minor version releases. The + listed defaults are conservative on the side of being usable on both + Debian Jessie and Debian Stretch as of time of this writing. For + Debian Stretch machines you will most likely end up updating the + list almost immediatelly. **pipreqcheck_uid** (integer, optional, ``whatever OS picks``) UID for user running the pip requirements upgrade checks. User is created with diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index 2904099a56d1bfaa80466ada0b1a80a34248e3ad..7e178de0245cdae760a17f04ce8f3912775b647d 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -14,11 +14,18 @@ extra_backup_patterns: - "/home" pip_check_requirements: - click==7.0 - - pip-tools==3.1.0 - - pip==18.1 - - setuptools==40.6.2 - - six==1.11.0 - - wheel==0.32.3 + - pip-tools==4.0.0 + - pip==19.2.3 + - setuptools==41.2.0 + - six==1.12.0 + - wheel==0.33.6 +pip_check_requirements_py3: + - click==7.0 + - pip-tools==3.9.0 + - pip==19.1.1 + - setuptools==41.2.0 + - six==1.12.0 + - wheel==0.33.6 ntp_servers: [] # Internal use only. diff --git a/roles/common/files/pipreqcheck_requirements.in b/roles/common/files/pipreqcheck_requirements.in index d42936a4179da7e2829f20254835a126513c858c..29fbfc8bab205d660a5e8578723812283f602c09 100644 --- a/roles/common/files/pipreqcheck_requirements.in +++ b/roles/common/files/pipreqcheck_requirements.in @@ -1,3 +1,4 @@ pip pip-tools -setuptools \ No newline at end of file +setuptools +wheel \ No newline at end of file diff --git a/roles/common/molecule/default/tests/test_default.py b/roles/common/molecule/default/tests/test_default.py index 1ba7d5b1a37a7bab879ec45568ef729dc28c3e5a..cc8d7eaeda84b5a19d41a8212eab39c037cb9c22 100644 --- a/roles/common/molecule/default/tests/test_default.py +++ b/roles/common/molecule/default/tests/test_default.py @@ -308,19 +308,19 @@ def test_pipreqcheck_requirements(host, requirements_in_path, requirements_txt_p @pytest.mark.parametrize("pip_path, expected_packages", [ ('/var/lib/pipreqcheck/virtualenv/bin/pip', [ "Click==7.0", - "pip==18.1", - "pip-tools==3.1.0", - "setuptools==40.6.2", - "six==1.11.0", - "wheel==0.32.3" + "pip==19.2.3", + "pip-tools==4.0.0", + "setuptools==41.2.0", + "six==1.12.0", + "wheel==0.33.6", ]), ('/var/lib/pipreqcheck/virtualenv-py3/bin/pip', [ "Click==7.0", - "pip==18.1", - "pip-tools==3.1.0", - "setuptools==40.6.2", - "six==1.11.0", - "wheel==0.32.3", + "pip==19.1.1", + "pip-tools==3.9.0", + "setuptools==41.2.0", + "six==1.12.0", + "wheel==0.33.6", ]), ]) def test_pipreqcheck_virtualenv_packages(host, pip_path, expected_packages): diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 7da8e40a58f6d9f5bd697b8ee5125edd87641e7f..62d900043a5a502bdc2e3f351ac6b024c26edf3e 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -383,13 +383,15 @@ - name: Deploy requirements file for pipreqcheck virtual environment template: src: "pipreqcheck_requirements.txt.j2" - dest: "{{ item }}" + dest: "{{ item.file }}" owner: root group: pipreqcheck mode: 0640 with_items: - - "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt" - - "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt" + - file: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt" + requirements: "{{ pip_check_requirements }}" + - file: "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt" + requirements: "{{ pip_check_requirements_py3 }}" - name: Install requirements in the pipreqcheck virtual environment pip: diff --git a/roles/common/templates/pipreqcheck_requirements.txt.j2 b/roles/common/templates/pipreqcheck_requirements.txt.j2 index 3ab42c6c01ed9b5480eaa48384498c5121d4e921..85e491c7b4c392f90ec14b97df10a6c0f7f88ed2 100644 --- a/roles/common/templates/pipreqcheck_requirements.txt.j2 +++ b/roles/common/templates/pipreqcheck_requirements.txt.j2 @@ -1,3 +1,3 @@ -{% for requirement in pip_check_requirements %} +{% for requirement in item.requirements %} {{ requirement }} {% endfor %}