Optimize linters executions from tox and pre-commit

This patch merges all the tox linters testenv into one. It also installs
the required Ansible collections with ansible-galaxy before executing
ansible-lint.

Morever, the 'end-of-file-fixer' pre-commit hook is working again and
this patch is fixing all the related issues.

Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: Ib823c6c65b4853e951cb001a6eed354ba2127965
(cherry picked from commit abe513cc90)
This commit is contained in:
Gael Chamoulaud (Strider) 2021-11-24 11:22:32 +01:00
parent fef7cf7ce3
commit ef1afa98ae
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
62 changed files with 5 additions and 106 deletions

View File

@ -12,8 +12,6 @@ repos:
- id: debug-statements
- id: flake8
entry: flake8 --ignore=E24,E121,E122,E123,E124,E126,E226,E265,E305,E402,F401,F405,E501,E704,F403,F841,W503,W605
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.15.0
hooks:

View File

@ -173,4 +173,3 @@
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

View File

@ -1,2 +1 @@
[python: **.py]

View File

@ -7,4 +7,3 @@ Contents:
:glob:
modules/*

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/ceph_pools_pg_protection.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/check_cpus_aligned_with_dpdk_nics.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/check_flavors.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/check_ironic_boot_config.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/check_other_processes_pmd_usage.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/convert_range_to_numbers_list.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/docker_facts.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/get_dpdk_nics_numa_info.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/icmp_ping.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/ip_range.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/network_environment.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/node_disks.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/overcloudrc.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/ovs_dpdk_pmd_cpus_check.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/pacemaker.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/pmd_threads_siblings_check.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/switch_vlans.py
:documentation: true
:examples: true

View File

@ -12,4 +12,3 @@ This module provides for the following ansible plugin:
:module: library/verify_profiles.py
:documentation: true
:examples: true

View File

@ -7,4 +7,3 @@ Contents:
:glob:
roles/*

View File

@ -4,4 +4,3 @@ ceilometerdb_size
.. ansibleautoplugin::
:role: roles/ceilometerdb_size

View File

@ -4,4 +4,3 @@ ceph
.. ansibleautoplugin::
:role: roles/ceph

View File

@ -4,4 +4,3 @@ check_network_gateway
.. ansibleautoplugin::
:role: roles/check_network_gateway

View File

@ -4,4 +4,3 @@ collect_flavors_and_verify_profiles
.. ansibleautoplugin::
:role: roles/collect_flavors_and_verify_profiles

View File

@ -6,4 +6,3 @@ compute_tsx
.. ansibleautoplugin::
:role: roles/compute_tsx

View File

@ -4,4 +4,3 @@ containerized_undercloud_docker
.. ansibleautoplugin::
:role: roles/containerized_undercloud_docker

View File

@ -4,4 +4,3 @@ controller_token
.. ansibleautoplugin::
:role: roles/controller_token

View File

@ -4,4 +4,3 @@ controller_ulimits
.. ansibleautoplugin::
:role: roles/controller_ulimits

View File

@ -4,4 +4,3 @@ ctlplane_ip_range
.. ansibleautoplugin::
:role: roles/ctlplane_ip_range

View File

@ -4,4 +4,3 @@ default_node_count
.. ansibleautoplugin::
:role: roles/default_node_count

View File

@ -4,4 +4,3 @@ dhcp_validations
.. ansibleautoplugin::
:role: roles/dhcp_validations

View File

@ -4,4 +4,3 @@ image_serve
.. ansibleautoplugin::
:role: roles/image_serve

View File

@ -4,4 +4,3 @@ ironic_boot_configuration
.. ansibleautoplugin::
:role: roles/ironic_boot_configuration

View File

@ -4,4 +4,3 @@ mysql_open_files_limit
.. ansibleautoplugin::
:role: roles/mysql_open_files_limit

View File

@ -4,4 +4,3 @@ network_environment
.. ansibleautoplugin::
:role: roles/network_environment

View File

@ -4,4 +4,3 @@ neutron_sanity_check
.. ansibleautoplugin::
:role: roles/neutron_sanity_check

View File

@ -4,4 +4,3 @@ node_disks
.. ansibleautoplugin::
:role: roles/node_disks

View File

@ -4,4 +4,3 @@ node_health
.. ansibleautoplugin::
:role: roles/node_health

View File

@ -46,4 +46,3 @@ Full Description
.. ansibleautoplugin::
:role: roles/nova_event_callback

View File

@ -4,4 +4,3 @@ nova_status
.. ansibleautoplugin::
:role: roles/nova_status

View File

@ -4,4 +4,3 @@ openshift_on_openstack
.. ansibleautoplugin::
:role: roles/openshift_on_openstack

View File

@ -4,4 +4,3 @@ openstack_endpoints
.. ansibleautoplugin::
:role: roles/openstack_endpoints

View File

@ -4,4 +4,3 @@ overcloud_service_status
.. ansibleautoplugin::
:role: roles/overcloud_service_status

View File

@ -4,4 +4,3 @@ ovs_dpdk_pmd
.. ansibleautoplugin::
:role: roles/ovs_dpdk_pmd

View File

@ -4,4 +4,3 @@ pacemaker_status
.. ansibleautoplugin::
:role: roles/pacemaker_status

View File

@ -4,4 +4,3 @@ rabbitmq_limits
.. ansibleautoplugin::
:role: roles/rabbitmq_limits

View File

@ -4,4 +4,3 @@ repos
.. ansibleautoplugin::
:role: roles/repos

View File

@ -4,4 +4,3 @@ stack_health
.. ansibleautoplugin::
:role: roles/stack_health

View File

@ -4,4 +4,3 @@ stonith_exists
.. ansibleautoplugin::
:role: roles/stonith_exists

View File

@ -4,4 +4,3 @@ switch_vlans
.. ansibleautoplugin::
:role: roles/switch_vlans

View File

@ -4,4 +4,3 @@ tls_everywhere
.. ansibleautoplugin::
:role: roles/tls_everywhere

View File

@ -4,4 +4,3 @@ undercloud_debug
.. ansibleautoplugin::
:role: roles/undercloud_debug

View File

@ -4,4 +4,3 @@ undercloud_disk_space
.. ansibleautoplugin::
:role: roles/undercloud_disk_space

View File

@ -4,4 +4,3 @@ undercloud_heat_purge_deleted
.. ansibleautoplugin::
:role: roles/undercloud_heat_purge_deleted

View File

@ -4,4 +4,3 @@ undercloud_process_count
.. ansibleautoplugin::
:role: roles/undercloud_process_count

View File

@ -4,4 +4,3 @@ undercloud_service_status
.. ansibleautoplugin::
:role: roles/undercloud_service_status

View File

@ -2,4 +2,4 @@
features:
- |
Adds a ceph-health check which prints a warning message if Ceph cluster
is in HEALTH_WARN state at the end of the Overcloud deployment
is in HEALTH_WARN state at the end of the Overcloud deployment

View File

@ -1 +1 @@
test ansible_connection=local ansible_host=localhost
test ansible_connection=local ansible_host=localhost

47
tox.ini
View File

@ -28,7 +28,8 @@ deps =
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
-r {toxinidir}/molecule-requirements.txt
whitelist_externals = bash
whitelist_externals =
bash
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
@ -41,44 +42,6 @@ commands = bindep test
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:pep8]
envdir = {toxworkdir}/linters
commands =
python -m pre_commit run flake8 -a
[testenv:ansible-lint]
envdir = {toxworkdir}/linters
deps =
{[testenv:linters]deps}
commands =
bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/roles'"
bash -c "ANSIBLE_LIBRARY='{toxinidir}/library'"
python -m pre_commit run ansible-lint -a
[testenv:yamllint]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run yamllint -a
[testenv:bashate]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run bashate -a
[testenv:whitespace]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run trailing-whitespace -a
[testenv:shebangs]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run check-executables-have-shebangs -a
[testenv:linters]
deps =
-r {toxinidir}/requirements.txt
@ -86,11 +49,7 @@ deps =
-r {toxinidir}/molecule-requirements.txt
commands =
python '{toxinidir}/tools/validate-files.py' .
{[testenv:ansible-lint]commands}
{[testenv:yamllint]commands}
{[testenv:bashate]commands}
{[testenv:whitespace]commands}
{[testenv:shebangs]commands}
python -m pre_commit run -a
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt