From f34bb772a018d3ee3a2872358542ad51c22fc06e Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Mon, 8 Feb 2021 15:54:17 +0100 Subject: [PATCH] Fix virtualbmc installation after release of cryptography 3.4 Installing virtualbmc system-wide on CentOS 8 fails with: ModuleNotFoundError: No module named 'setuptools_rust' This error appeared following the release of cryptography 3.4, which now includes Rust code. It can be installed without Rust using a Python wheel, but only with more recent pip than version 9.0.3 available as RPM on CentOS 8. The cryptography bug report [1] recommends pip>=19.1.1. Also ignore PyYAML when installing system-wide to avoid conflicts with an existing RPM package installation. [1] https://github.com/pyca/cryptography/issues/5753 Change-Id: Ibd61e090611b3b7a7e0670c854362b512454bf3c Story: 2008607 Task: 41788 --- ansible/roles/virtualbmc-daemon/tasks/main.yml | 13 +++++++++++++ .../virtualbmc-cryptography-03d62a3d1e965197.yaml | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/virtualbmc-cryptography-03d62a3d1e965197.yaml diff --git a/ansible/roles/virtualbmc-daemon/tasks/main.yml b/ansible/roles/virtualbmc-daemon/tasks/main.yml index 6aa26a6..e97dc33 100644 --- a/ansible/roles/virtualbmc-daemon/tasks/main.yml +++ b/ansible/roles/virtualbmc-daemon/tasks/main.yml @@ -18,12 +18,25 @@ retries: 3 become: true +# NOTE(priteau): We need a recent pip to install the latest cryptography +# library. See https://github.com/pyca/cryptography/issues/5753 +- name: Ensure a recent version of pip is installed + pip: + name: "pip>=19.1.1" + virtualenv: "{{ vbmcd_virtualenv_path or omit }}" + become: "{{ not vbmcd_virtualenv_path }}" + - name: Ensure Python requirements are installed pip: name: - "virtualbmc>=1.4.0{% if ansible_python.version.major == 2 %},<2{% endif %}" + # NOTE(priteau): Ignore PyYAML when installing system-wide to avoid the + # following error: Cannot uninstall 'PyYAML'. It is a distutils installed + # project and thus we cannot accurately determine which files belong to it + # which would lead to only a partial uninstall. extra_args: >- -c {{ vbmcd_python_upper_constraints_url }} + {% if not vbmcd_virtualenv_path %}--ignore-installed PyYAML{% endif %} virtualenv: "{{ vbmcd_virtualenv_path or omit }}" register: result until: result is success diff --git a/releasenotes/notes/virtualbmc-cryptography-03d62a3d1e965197.yaml b/releasenotes/notes/virtualbmc-cryptography-03d62a3d1e965197.yaml new file mode 100644 index 0000000..7b2fab2 --- /dev/null +++ b/releasenotes/notes/virtualbmc-cryptography-03d62a3d1e965197.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes system-wide installation of virtualbmc following the release of + version 3.4 of the cryptography package. See `story 2008607 + `__ for details.