python-tempestconf/roles/generate-tempestconf-file-cloud/tasks/main.yaml
Martin Kopec c3ea997627 Run unit tests by py38 as well
Let's use openstack-python3-wallaby-jobs template.
Also update setup.cfg to be compatible with supported pythons.
flake8==2.6.2 and pyflakes==2.0.0 seems not to be compatible
with python3.8 on Ubuntu so the patch addresses this as well.

Change-Id: Ic09b2d836315d9a223bb8592d0e48ef475c56aa5
2020-09-25 08:11:29 +00:00

119 lines
3.7 KiB
YAML

- block:
- name: Ensure python-virtualenv is present
include_role:
name: ensure-virtualenv
- name: Create python-tempestconf venv with latest pip, setuptools and pbr
pip:
virtualenv: "{{ virtualenvs.tempestconf }}"
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}"
name: "{{ item }}"
state: latest
with_items:
- pip
- setuptools
- pbr
- name: Debug, list tempestconf dir
shell: |
set -ex
ls -all .
pwd
args:
chdir: "{{ tempestconf_src_relative_path }}"
- name: Install python-tempestconf (with constraints)
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
pip install -c {{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/upper-constraints.txt .
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
when: branch is defined
- name: Install python-tempestconf
pip:
name: "."
virtualenv: "{{ virtualenvs.tempestconf }}"
chdir: "{{ tempestconf_src_relative_path }}"
virtualenv_python: "{{ tempestconf_pip_virtualenv_python|default(omit) }}"
when: branch is not defined
- name: Generate tempest configuration file
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
discover-tempest-config \
--out etc/cloud_tempest.conf \
--debug \
-v \
{% if cloud_user == "devstack-admin" %}
--create \
{% else %}
--non-admin \
{% endif %}
--os-cloud {{ cloud_user }} \
auth.tempest_roles Member
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- set_fact:
profile:
debug: true
out: etc/tempest_profile.conf
verbose: true
create: "{{ cloud_user == 'devstack-admin' }}"
non_admin: "{{ cloud_user == 'devstack' }}"
os_cloud: "{{ cloud_user }}"
overrides:
auth.tempest_roles: Member
- name: Generate sample profile.yaml file
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
discover-tempest-config \
--generate-profile ./etc/profile.yaml
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- name: Edit the profile.yaml file
copy:
content: "{{ profile | to_nice_yaml }}"
dest: "{{ tempestconf_src_relative_path }}/etc/profile.yaml"
- name: Generate tempest configuration file with profile.yaml
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ virtualenvs.tempestconf }}/bin/activate
printenv
cat ./etc/profile.yaml
discover-tempest-config \
--profile ./etc/profile.yaml
args:
chdir: "{{ tempestconf_src_relative_path }}"
executable: /bin/bash
- name: Compare tempest.conf and tempest_profile.conf
shell: |
python3 ./roles/generate-tempestconf-file-cloud/tasks/compare-ini.py ./etc/cloud_tempest.conf ./etc/tempest_profile.conf
args:
chdir: "{{ tempestconf_src_relative_path }}"
- name: Print generated tempest.conf
shell: |
set -ex
cat {{ tempestconf_src_relative_path }}/etc/cloud_tempest.conf
vars:
tempestconf_src_relative_path: "{{ zuul.projects['opendev.org/osf/python-tempestconf'].src_dir }}"