Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new linters were added, that enabled by default. In order to comply with linter rules we're applying changes to the role. With that we also update metdata to reflect current state. Change-Id: I6b4b83ec472d4a3de9139eb4e7c7b2dc8a9fc260
This commit is contained in:
parent
0e1abb2858
commit
43032d25cf
@ -83,7 +83,7 @@ venv_pip_build_env: {}
|
|||||||
venv_default_pip_install_args: >-
|
venv_default_pip_install_args: >-
|
||||||
{%- if (groups[venv_build_group] is defined) and (groups[venv_build_group] | length > 0) and (venv_wheel_build_enable | bool) %}
|
{%- if (groups[venv_build_group] is defined) and (groups[venv_build_group] | length > 0) and (venv_wheel_build_enable | bool) %}
|
||||||
--find-links {{ openstack_repo_url | default('http://localhost') }}/os-releases/{{ openstack_release | default('master') }}/{{ _venv_build_dist_arch }}/wheels
|
--find-links {{ openstack_repo_url | default('http://localhost') }}/os-releases/{{ openstack_release | default('master') }}/{{ _venv_build_dist_arch }}/wheels
|
||||||
--trusted-host {{ (openstack_repo_url | default('http://localhost')) | urlsplit('hostname') }}
|
--trusted-host {{ (openstack_repo_url | default('http://localhost')) | urlsplit('hostname') -}}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# Arguments to pass to pip when installing into the venv
|
# Arguments to pass to pip when installing into the venv
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: venv changed
|
- name: Virtual Environment changed
|
||||||
meta: noop
|
meta: noop
|
||||||
when: false
|
when: false
|
||||||
|
listen:
|
||||||
|
- venv changed
|
||||||
|
@ -18,19 +18,21 @@ galaxy_info:
|
|||||||
description: Python venv preparation
|
description: Python venv preparation
|
||||||
company: OpenStack
|
company: OpenStack
|
||||||
license: Apache2
|
license: Apache2
|
||||||
min_ansible_version: 2.4
|
role_name: python_venv_build
|
||||||
|
namespace: openstack
|
||||||
|
min_ansible_version: "2.10"
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- buster
|
- bullseye
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions:
|
versions:
|
||||||
- bionic
|
|
||||||
- focal
|
- focal
|
||||||
|
- jammy
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 8
|
- "9"
|
||||||
categories:
|
galaxy_tags:
|
||||||
- cloud
|
- cloud
|
||||||
- python
|
- python
|
||||||
- development
|
- development
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- name: gather build target facts
|
- name: Gather build target facts
|
||||||
setup:
|
setup:
|
||||||
gather_subset: '!all:min'
|
gather_subset: '!all:min'
|
||||||
delegate_to: "{{ item }}"
|
delegate_to: "{{ item }}"
|
||||||
@ -73,7 +73,8 @@
|
|||||||
- venv_wheel_build_enable | bool
|
- venv_wheel_build_enable | bool
|
||||||
- _venv_build_dist_arch not in venv_build_targets
|
- _venv_build_dist_arch not in venv_build_targets
|
||||||
|
|
||||||
- include_tasks: "python_venv_wheel_build.yml"
|
- name: Including python_venv_wheel_build tasks
|
||||||
|
include_tasks: "python_venv_wheel_build.yml"
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
tags:
|
tags:
|
||||||
@ -84,11 +85,13 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
- import_tasks: "python_venv_install.yml"
|
- name: Including python_venv_install tasks
|
||||||
|
import_tasks: "python_venv_install.yml"
|
||||||
tags:
|
tags:
|
||||||
- install
|
- install
|
||||||
|
|
||||||
- include_tasks: "python_venv_set_facts.yml"
|
- name: Including python_venv_set_facts tasks
|
||||||
|
include_tasks: "python_venv_set_facts.yml"
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
tags:
|
tags:
|
||||||
|
@ -28,7 +28,18 @@
|
|||||||
|
|
||||||
- name: Install distro packages for venv build
|
- name: Install distro packages for venv build
|
||||||
package:
|
package:
|
||||||
name: "{{ (venv_wheel_build_enable | bool) | ternary(venv_install_base_distro_package_list | union(venv_install_distro_package_list), (venv_build_base_distro_package_list | union(venv_build_distro_package_list) | union(venv_install_base_distro_package_list) | union(venv_install_distro_package_list))) }}"
|
name: >-
|
||||||
|
{{
|
||||||
|
(venv_wheel_build_enable | bool) | ternary(
|
||||||
|
venv_install_base_distro_package_list | union(venv_install_distro_package_list),
|
||||||
|
(
|
||||||
|
venv_build_base_distro_package_list |
|
||||||
|
union(venv_build_distro_package_list) |
|
||||||
|
union(venv_install_base_distro_package_list) |
|
||||||
|
union(venv_install_distro_package_list)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}}
|
||||||
state: "{{ venv_distro_package_state }}"
|
state: "{{ venv_distro_package_state }}"
|
||||||
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
|
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
|
||||||
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}"
|
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}"
|
||||||
@ -51,6 +62,7 @@
|
|||||||
file:
|
file:
|
||||||
path: "{{ venv_install_destination_path }}"
|
path: "{{ venv_install_destination_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
# Note(jrosser)
|
# Note(jrosser)
|
||||||
# If the constraints file from the wheel build has been previously collected
|
# If the constraints file from the wheel build has been previously collected
|
||||||
@ -84,6 +96,7 @@
|
|||||||
copy:
|
copy:
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
content: "{{ item.content }}"
|
content: "{{ item.content }}"
|
||||||
|
mode: "0644"
|
||||||
with_items:
|
with_items:
|
||||||
- dest: "{{ venv_install_destination_path }}/requirements.txt"
|
- dest: "{{ venv_install_destination_path }}/requirements.txt"
|
||||||
content: |-
|
content: |-
|
||||||
|
@ -25,7 +25,12 @@
|
|||||||
vars:
|
vars:
|
||||||
_venv_python_major_version: "{{ (_python_venv_details.files[0].path | basename | split('.') )[0] }}"
|
_venv_python_major_version: "{{ (_python_venv_details.files[0].path | basename | split('.') )[0] }}"
|
||||||
shell: >-
|
shell: >-
|
||||||
{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('dpkg -L ' ~ (venv_packages_to_symlink | join(' ')), 'rpm -ql ' ~ (venv_packages_to_symlink | join(' ')) ) }}
|
{{
|
||||||
|
(ansible_facts['pkg_mgr'] == 'apt') | ternary(
|
||||||
|
'dpkg -L ' ~ (venv_packages_to_symlink | join(' ')),
|
||||||
|
'rpm -ql ' ~ (venv_packages_to_symlink | join(' '))
|
||||||
|
)
|
||||||
|
}}
|
||||||
| egrep '^.*{{ _venv_python_major_version }}.*/(site|dist)-packages/.*'
|
| egrep '^.*{{ _venv_python_major_version }}.*/(site|dist)-packages/.*'
|
||||||
| egrep -v "__pycache__"
|
| egrep -v "__pycache__"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
file:
|
file:
|
||||||
path: /etc/ansible/facts.d
|
path: /etc/ansible/facts.d
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- name: Record the necessary facts
|
- name: Record the necessary facts
|
||||||
become: true
|
become: true
|
||||||
@ -26,6 +27,7 @@
|
|||||||
section: "{{ item.section }}"
|
section: "{{ item.section }}"
|
||||||
option: "{{ item.option }}"
|
option: "{{ item.option }}"
|
||||||
value: "{{ item.value | string }}"
|
value: "{{ item.value | string }}"
|
||||||
|
mode: "0644"
|
||||||
with_items: "{{ venv_facts_when_changed }}"
|
with_items: "{{ venv_facts_when_changed }}"
|
||||||
when:
|
when:
|
||||||
- (_install_venv_pip_packages is defined and
|
- (_install_venv_pip_packages is defined and
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
||||||
group: "{{ venv_build_host_group_name | default(omit) }}"
|
group: "{{ venv_build_host_group_name | default(omit) }}"
|
||||||
|
mode: "0755"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ venv_build_host_wheel_path }}"
|
- "{{ venv_build_host_wheel_path }}"
|
||||||
- "{{ venv_build_host_requirements_path }}"
|
- "{{ venv_build_host_requirements_path }}"
|
||||||
@ -61,6 +62,7 @@
|
|||||||
content: "{{ item.content }}"
|
content: "{{ item.content }}"
|
||||||
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
||||||
group: "{{ venv_build_host_group_name | default(omit) }}"
|
group: "{{ venv_build_host_group_name | default(omit) }}"
|
||||||
|
mode: "0644"
|
||||||
with_items:
|
with_items:
|
||||||
- dest: "{{ _venv_build_requirements_prefix }}-requirements.txt"
|
- dest: "{{ _venv_build_requirements_prefix }}-requirements.txt"
|
||||||
content: |-
|
content: |-
|
||||||
@ -111,7 +113,7 @@
|
|||||||
path: "/tmp/{{ venv_install_destination_path | basename }}"
|
path: "/tmp/{{ venv_install_destination_path | basename }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Build wheels for the packages to be installed into the venv
|
- name: Build wheels for the packages to be installed into the venv # noqa: no-changed-when
|
||||||
command: >-
|
command: >-
|
||||||
{{ venv_build_host_venv_path }}/bin/pip wheel
|
{{ venv_build_host_venv_path }}/bin/pip wheel
|
||||||
--requirement {{ _venv_build_requirements_prefix }}-requirements.txt
|
--requirement {{ _venv_build_requirements_prefix }}-requirements.txt
|
||||||
@ -147,6 +149,7 @@
|
|||||||
- name: Move built wheels to common wheel path
|
- name: Move built wheels to common wheel path
|
||||||
shell: >-
|
shell: >-
|
||||||
mv /tmp/{{ venv_install_destination_path | basename }}/* {{ venv_build_host_wheel_path }}/
|
mv /tmp/{{ venv_install_destination_path | basename }}/* {{ venv_build_host_wheel_path }}/
|
||||||
|
changed_when: false
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
@ -160,3 +163,4 @@
|
|||||||
dest: "{{ _venv_build_requirements_prefix }}-constraints.txt"
|
dest: "{{ _venv_build_requirements_prefix }}-constraints.txt"
|
||||||
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
owner: "{{ venv_build_host_user_name | default(omit) }}"
|
||||||
group: "{{ venv_build_host_group_name | default(omit) }}"
|
group: "{{ venv_build_host_group_name | default(omit) }}"
|
||||||
|
mode: "0644"
|
||||||
|
@ -55,7 +55,7 @@ venv_build_targets: |-
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ targets }}
|
{{ targets }}
|
||||||
|
|
||||||
_venv_wheels_play_hosts: |
|
_venv_wheels_play_hosts: |-
|
||||||
{% set wheel_groups = {} %}
|
{% set wheel_groups = {} %}
|
||||||
{% for host in ansible_play_hosts %}
|
{% for host in ansible_play_hosts %}
|
||||||
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
|
{% set arch = hostvars[host]['ansible_facts']['architecture'] %}
|
||||||
@ -70,7 +70,7 @@ _venv_wheels_play_hosts: |
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ wheel_groups }}
|
{{ wheel_groups }}
|
||||||
|
|
||||||
_venv_wheels_first_play_hosts: |
|
_venv_wheels_first_play_hosts: |-
|
||||||
{% set first_hosts = [] %}
|
{% set first_hosts = [] %}
|
||||||
{% for distro_arch_hosts in _venv_wheels_play_hosts.values() %}
|
{% for distro_arch_hosts in _venv_wheels_play_hosts.values() %}
|
||||||
{% set _ = first_hosts.append(distro_arch_hosts | first) %}
|
{% set _ = first_hosts.append(distro_arch_hosts | first) %}
|
||||||
@ -79,6 +79,11 @@ _venv_wheels_first_play_hosts: |
|
|||||||
|
|
||||||
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"
|
_venv_pip_packages: "{{ (venv_default_pip_packages | union(venv_pip_packages)) | sort | select | list }}"
|
||||||
|
|
||||||
_venv_build_dist_arch: "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}-{{ ansible_facts['distribution_version'].split('.')[:2] | join('.') }}-{{ ansible_facts['architecture'] | lower }}"
|
_venv_build_dist_arch: >-
|
||||||
|
{{
|
||||||
|
((ansible_facts['distribution'] | lower) | replace(' ', '_')) ~ '-' ~
|
||||||
|
(ansible_facts['distribution_version'].split('.')[:2] | join('.')) ~ '-' ~
|
||||||
|
(ansible_facts['architecture'] | lower)
|
||||||
|
}}
|
||||||
|
|
||||||
_venv_build_requirements_prefix: "{{ venv_build_host_requirements_path }}/{{ venv_install_destination_path | basename }}"
|
_venv_build_requirements_prefix: "{{ venv_build_host_requirements_path }}/{{ venv_install_destination_path | basename }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user