Ensure PATH contains the virtual environment when validating CLI

Change-Id: I1c3f195636bb63cad19638c32631d2b753c7ea40
This commit is contained in:
Dmitry Tantsur 2020-10-28 14:21:08 +01:00
parent 2e4d851272
commit e6ff691208
3 changed files with 14 additions and 6 deletions

View File

@ -18,6 +18,10 @@ ironic_inspector_api_url: "{{ api_protocol }}://{{ internal_ip }}:5050"
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
bifrost_venv_env:
VIRTUAL_ENV: "{{ bifrost_venv_dir }}"
PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env
pydoc: "python -m pydoc"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
enable_keystone: false

View File

@ -18,19 +18,16 @@
- block:
- name: "List bare metal nodes using CLI and clouds.yaml"
command: baremetal --debug node list
environment:
OS_CLOUD: "{{ testing_cloud_name }}"
environment: "{{ bifrost_venv_env | combine({'OS_CLOUD': testing_cloud_name }) }}"
- name: "List introspection rules using CLI and clouds.yaml"
command: baremetal --debug introspection rule list
environment:
OS_CLOUD: "{{ testing_cloud_name }}"
environment: "{{ bifrost_venv_env | combine({'OS_CLOUD': testing_cloud_name }) }}"
when: enable_inspector | bool
- name: "List services using CLI and clouds.yaml"
command: openstack --debug service list
environment:
OS_CLOUD: bifrost-admin
environment: "{{ bifrost_venv_env | combine({'OS_CLOUD': 'bifrost-admin' }) }}"
when:
- enable_keystone | bool
- "'bifrost-admin' in clouds"
@ -42,6 +39,7 @@
baremetal --debug node list
args:
executable: /bin/bash
environment: "{{ bifrost_venv_env }}"
# FIXME(dtantsur): openrc provides no overrides for ironic-inspector, so we
# cannot test it.
@ -53,6 +51,7 @@
openstack --debug service list
args:
executable: /bin/bash
environment: "{{ bifrost_venv_env }}"
when:
- enable_keystone | bool
- "'bifrost-admin' in clouds"

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes ``PATH`` to always include the virtual environment when running
validations.