system-config/tox.ini
Ian Wienand 41127eb1c9 linters: ensure openstack/inventory.yaml parses
This runs openstack/inventory.yaml through a basic syntax check.  This
would have caught a typo such as in
I0e55d2c575427e404709e78d0c7a10a974117ac4 (fixed
I834411ef2dee458ae15fb99a3c88b6d2fee4cf1e)

Change-Id: I4cbf9898d598aeeef1583ab22ceb9d0cdf081064
2019-06-12 10:23:46 +10:00

64 lines
2.3 KiB
INI

[tox]
minversion = 1.6
envlist = linters
skipsdist = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
whitelist_externals = bash
commands =
flake8
{toxinidir}/tools/run-bashate.sh
python3 {toxinidir}/tools/sorted_modules_env.py {toxinidir}/modules.env
python3 {toxinidir}/tools/irc_checks.py
python3 {toxinidir}/tools/check_clouds_yaml.py
# The following command validates that inventory/openstack.yaml
# parses, but doesn't do anything.
bash -c "ANSIBLE_INVENTORY_PLUGINS=./playbooks/roles/install-ansible/files/inventory_plugins ansible -i ./inventory/openstack.yaml not_a_host -a 'true'"
python3 -m unittest playbooks/roles/install-ansible/files/inventory_plugins/test_yamlgroup.py
# Ansible Lint Check
#
# ANSIBLE0010: Package installs should not use latest
# We often deploy latest pip packages
#
# 204: Lines < 160
# Things like keys, script lines, etc exceed this. We have good
# taste and only use long lines where appropriate.
#
# 206: {{var}} should have spaces {{ var }}
# This rule seems sane, but it appears there's no way to convince
# ansible-lint perfectly good things that are *not* ansible (like
# exim configs) in YAML shouldn't have to follow this rule. See
# https://github.com/ansible/ansible-lint/issues/534; might be able
# to turn on if fixed.
#
# 306: shells with pipes should use pipefail
# This requires running the shell as /bin/bash. There is a small
# possibility to hide errors, but we can rely on
# developers to decide when to explicitly check for failures.
bash -c "find roles playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
ansible-lint -x ANSIBLE0004 -x ANSIBLE0006 -x ANSIBLE0007 -x ANSIBLE0010 \
-x ANSIBLE0011 -x ANSIBLE0012 -x ANSIBLE0013 -x ANSIBLE0015 \
-x 204 -x 206 -x 304 -x 306"
[testenv:venv]
commands = {posargs}
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -E -b html doc/source doc/build/html
[testenv:testinfra]
commands = py.test --junit-xml junit.xml --connection=ansible --ansible-inventory=/etc/ansible/hosts/inventory.yaml -v testinfra {posargs}
[flake8]
show-source = True
exclude = .tox,.eggs
ignore = E125,H
select = H231