c60b55ec83
This commit enanbles Ansible linting and does some minor refactoring to make existing Ansible roles compatible with the new rules. Several Ansible linting rules have been excluded to keep the number of changes from being too onerous. Also a new script in ci-scripts is used to check very config file included in the Browbeat repo for validity using the template Browbeat uses when it runs. Here's a list of the new linting rules * Ansible tasks must have names * When you use shell you must use become not sudo * Using become_user without using become is not allowed * If a repo is pulled it must be a pinned version of commit, not latest * Always_run is deprecated don't use it * Variables without {{}} and not in when statements are deprecated don't use them * No Trailing whitepaces * YAML checking, catches big syntax errors but not less obvious ones Change-Id: Ic531c91c408996d4e7d8899afe8b21d364998680
75 lines
2.3 KiB
INI
75 lines
2.3 KiB
INI
[tox]
|
|
minversion = 2.0
|
|
envlist = py27-constraints,pep8-constraints,linters
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
usedevelop = True
|
|
install_command =
|
|
constraints: {[testenv:common-constraints]install_command}
|
|
pip install -U {opts} {packages}
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = python setup.py test
|
|
|
|
[testenv:common-constraints]
|
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
|
|
|
|
|
[testenv:linters]
|
|
whitelist_externals = bash
|
|
commands =
|
|
pip install pykwalify
|
|
flake8
|
|
bash -c "cd ansible; find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
|
|
ansible-lint \
|
|
-x ANSIBLE0013,ANSIBLE0012,ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0016"
|
|
python ci-scripts/linters/lint-browbeat-config.py lib/validate.yaml browbeat-config.yaml
|
|
python ci-scripts/linters/lint-browbeat-config.py lib/validate.yaml browbeat-complete.yaml
|
|
bash -c "for config in $(ls conf/); do \
|
|
python ci-scripts/linters/lint-browbeat-config.py lib/validate.yaml conf/$config; done"
|
|
|
|
[testenv:pep8]
|
|
commands = flake8 {posargs} --exclude=ansible
|
|
|
|
[testenv:pep8-constraints]
|
|
install_command = {[testenv:common-constraints]install_command}
|
|
commands = flake8 {posargs}
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:venv-constraints]
|
|
install_command = {[testenv:common-constraints]install_command}
|
|
commands = {posargs}
|
|
|
|
[testenv:cover]
|
|
commands = python setup.py test --coverage --testr-args='{posargs}'
|
|
|
|
[testenv:cover-constraints]
|
|
install_command = {[testenv:common-constraints]install_command}
|
|
commands = python setup.py test --coverage --testr-args='{posargs}'
|
|
|
|
[testenv:docs]
|
|
commands = python setup.py build_sphinx
|
|
|
|
[testenv:docs-constraints]
|
|
install_command = {[testenv:common-constraints]install_command}
|
|
commands = python setup.py build_sphinx
|
|
|
|
[testenv:debug]
|
|
commands = oslo_debug_helper {posargs}
|
|
|
|
[testenv:debug-constraints]
|
|
install_command = {[testenv:common-constraints]install_command}
|
|
commands = oslo_debug_helper {posargs}
|
|
|
|
[flake8]
|
|
# E123, E125 skipped as they are invalid PEP-8.
|
|
show-source = True
|
|
ignore = E123,E125,E226,E302,E41,E111,E231,E203,H233,H306,H238,H236,H404,H405
|
|
max-line-length = 100
|
|
builtins = _
|
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible/*
|