From 3dd6834a618d3ac83a6c0e301182f7b6a0897cf2 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 9 Feb 2021 10:53:26 +0000 Subject: [PATCH] CI: fix kolla-ansible installation after cryptography 3.4 release Installing kolla-ansible 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. This change switches to using pip --user when installing kolla-ansible. Also fixes an issue with ansible-lint which was failing on etc/kolla/globals.yml due to a missing space before comments. [1] https://github.com/pyca/cryptography/issues/5753 Change-Id: Ifaf1948ed5d42eebaa62d7bad375bbfc12b134d5 Closes-Bug: #1915141 --- tests/post.yml | 2 ++ tests/run.yml | 19 +++++++++++++++---- tox.ini | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/post.yml b/tests/post.yml index 58fe4752d0..535fa953e3 100644 --- a/tests/post.yml +++ b/tests/post.yml @@ -50,6 +50,8 @@ - "--quiet" - hosts: primary + environment: + PATH: "{{ ansible_env.HOME + '/.local/bin:' + ansible_env.PATH }}" tasks: - name: check for existence of ara sqlite stat: diff --git a/tests/run.yml b/tests/run.yml index b2ed4a3aec..5ebce9e295 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -25,6 +25,8 @@ dashboard_enabled: "{{ openstack_core_enabled }}" upper_constraints_file: "{{ ansible_env.HOME }}/src/opendev.org/openstack/requirements/upper-constraints.txt" docker_image_tag_suffix: "{{ '-aarch64' if ansible_architecture == 'aarch64' else '' }}" + pip_user_path_env: + PATH: "{{ ansible_env.HOME + '/.local/bin:' + ansible_env.PATH }}" - name: Install dig for Designate testing become: true @@ -65,6 +67,7 @@ # NOTE(yoctozepto): to avoid issues with IPv6 not enabled in the docker daemon # and since we don't need isolated networks here, use host networking network_mode: host + environment: "{{ pip_user_path_env }}" tasks: - name: detect whether need build images set_fact: @@ -200,6 +203,14 @@ state: directory become: true + # NOTE(mgoddard): We need a recent pip to install the latest cryptography + # library. See https://github.com/pyca/cryptography/issues/5753 + - name: install pip 19.1.1+ + pip: + name: "pip>=19.1.1" + executable: "pip3" + extra_args: "--user" + - name: install kolla-ansible and dependencies vars: # Test latest ansible version on Ubuntu, minimum supported on others. @@ -210,8 +221,7 @@ - "ansible{{ ansible_version_constraint }}" - "ara<1.0.0" executable: "pip3" - extra_args: "-c {{ upper_constraints_file }}" - become: true + extra_args: "-c {{ upper_constraints_file }} --user" - name: get ARA callback plugin path command: "python3 -m ara.setup.callback_plugins" @@ -486,6 +496,7 @@ - hosts: primary any_errors_fatal: true + environment: "{{ pip_user_path_env }}" tasks: # Upgrade: update config. - block: @@ -529,8 +540,7 @@ pip: name: "{{ kolla_ansible_src_dir }}" executable: pip3 - extra_args: "-c {{ upper_constraints_file }}" - become: true + extra_args: "-c {{ upper_constraints_file }} --user" # Update passwords.yml to include any new passwords added in this # release. @@ -629,6 +639,7 @@ - hosts: primary any_errors_fatal: true + environment: "{{ pip_user_path_env }}" tasks: - name: Run reconfigure.sh script script: diff --git a/tox.ini b/tox.ini index 2ee920b582..9ef6e1b3da 100644 --- a/tox.ini +++ b/tox.ini @@ -126,7 +126,7 @@ setenv = {[testenv:linters]setenv} deps = {[testenv:linters]deps} commands = python {toxinidir}/tools/validate-all-file.py - ansible-lint -p --exclude {toxinidir}/tests --exclude {toxinidir}/roles + ansible-lint -p --exclude {toxinidir}/tests --exclude {toxinidir}/roles --exclude {toxinidir}/etc [testenv:yamllint] deps = {[testenv:linters]deps}