From 5746ed2a278f342dd2c00a31ceb6ef91e415bba5 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Fri, 9 Jul 2021 15:04:27 +0200 Subject: [PATCH] Fix 'The `libvirt` module is not importable' error Upper constraints were updated [1] to allow libvirt-python 7.5.0. The first Kayobe builds using this version worked fine, but later they started failing with the error: The `libvirt` module is not importable. Check the requirements. The main difference is that successful jobs were using the source archive libvirt-python-7.5.0.tar.gz, while failing jobs were using the wheel libvirt_python-7.5.0-cp36-cp36m-linux_x86_64.whl. Install libvirt-python from source to avoid this issue. Update the ansible-lint configuration to ignore errors coming from the stackhpc.libvirt-vm role, fixing the tenks-tox-ansible-lint job. [1] https://review.opendev.org/c/openstack/requirements/+/799347 Change-Id: I746d01ed355330c965b90657264d89a4ef7995d2 --- .ansible-lint | 3 +++ ansible/roles/virtualbmc-daemon/tasks/main.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.ansible-lint b/.ansible-lint index c430e1b..92d88fd 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,6 @@ skip_list: - '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern' +warn_list: + - experimental + - no-changed-when diff --git a/ansible/roles/virtualbmc-daemon/tasks/main.yml b/ansible/roles/virtualbmc-daemon/tasks/main.yml index e97dc33..343294c 100644 --- a/ansible/roles/virtualbmc-daemon/tasks/main.yml +++ b/ansible/roles/virtualbmc-daemon/tasks/main.yml @@ -34,9 +34,13 @@ # 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. + # NOTE(priteau): Use --no-binary to avoid installing libvirt-python from + # wheel. There is a problem with the 7.5.0 wheel resulting in the error: + # The `libvirt` module is not importable. Check the requirements. extra_args: >- -c {{ vbmcd_python_upper_constraints_url }} {% if not vbmcd_virtualenv_path %}--ignore-installed PyYAML{% endif %} + --no-binary libvirt-python virtualenv: "{{ vbmcd_virtualenv_path or omit }}" register: result until: result is success