ansible-role-refstack-client/tasks/install-refstack-client.yaml
Martin Kopec 3a3fb4f48b Fix linters python3.10 issues
Bump the version of ansible-lint and fix all warnings and failures
found by ansible-lint.
Also remove any python2 related code/tasks from
install-packages.yaml

Change-Id: If466227fb9872f1112b4577670c891bef5b31627
2023-06-22 00:08:33 +02:00

74 lines
2.6 KiB
YAML

---
- name: Check if refstack_client_source dir exists and if it's empty
ansible.builtin.find:
paths: "{{ refstack_client_source }}"
register: local_refstack_found
- name: Print refstack_client_source variable
ansible.builtin.debug:
var: refstack_client_source
- name: Clone refstack-client
ansible.builtin.git:
repo: 'https://opendev.org/openinfra/refstack-client.git'
dest: "{{ refstack_client_source }}"
version: "{{ refstack_client_version }}"
when: local_refstack_found.matched == 0
- name: Look for python3
ansible.builtin.command: "python3 --version"
ignore_errors: true
register: python3_is_available
changed_when: false
- name: Set python3 params for setup_env
ansible.builtin.set_fact:
python3_param: "-p 3"
when: python3_is_available.rc == 0
- name: Clone py2 python-tempestconf
ansible.builtin.git:
repo: 'https://git.openstack.org/openinfra/python-tempestconf.git'
dest: "{{ refstack_client_source }}/.tempestconf_source"
version: "2.5.0"
when:
- python3_is_available.rc != 0
- tempestconf_source is not defined
- when: refstack_tempest_plugins is defined
block:
# refstack-client allows installation of additional packages to find more
# tests by tempest. The additional tempest plugins should be defined in
# "tempest-additional-requirements.txt" file. This block enables this
# option by using "refstack_tempest_plugins" parameter.
# Usage:
# refstack_tempest_plugins: ===> refstack_tempest_plugins:
# <tempest_plugin_name>:<tag/branch> ===> manila:1.3.0
- name: Add additional requirements for external test suites
ansible.builtin.replace:
path: "{{ refstack_client_source }}/setup_env"
regexp: '#(.*tempest-additional-requirements.txt$)'
replace: '\1'
- name: Add tempest plugins to tempest-additional-requirements.txt
ansible.builtin.lineinfile:
path: "{{ refstack_client_source }}/tempest-additional-requirements.txt"
line: "git+https://opendev.org/openstack/{{ item.key }}-tempest-plugin.git@{{ item.value }}"
with_dict: "{{ refstack_tempest_plugins }}"
- name: Install refstack-client
ansible.builtin.shell: >
./setup_env {{ python3_param | default('') }}
{% if tempest_tag is defined %}
-t {{ tempest_tag }}
{% endif %}
{% if tempestconf_source is defined %}
-s {{ tempestconf_source }}
{% endif %}
{% if tempestconf_source is not defined and python3_is_available.rc != 0 %}
-s {{ refstack_client_source }}/.tempestconf_source
{% endif %}
args:
chdir: "{{ refstack_client_source }}"
changed_when: true