Use a zuul_* and add an .ansible-lint file
ansible-lint now supports settings in a file, including exclude_paths. This lets us simplfy the ansible-lint command. Also, stop installing zuul and just use a fake zuul_return and zuul_console to fake out ansible-lint. Change-Id: I1482a9ab915cec2d45695b60cdbeb93d58cb392c
This commit is contained in:
parent
de04f76d57
commit
c800638473
10
.ansible-lint
Normal file
10
.ansible-lint
Normal file
@ -0,0 +1,10 @@
|
||||
exclude_paths:
|
||||
- playbooks/legacy
|
||||
parseable: true
|
||||
# [ANSIBLE0012] Commands should not change things if nothing needs doing
|
||||
# [204] Lines should be no longer than 160 chars
|
||||
skip_list:
|
||||
- ANSIBLE0012
|
||||
- '204'
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
23
bindep.txt
23
bindep.txt
@ -1,23 +0,0 @@
|
||||
# This is a cross-platform list tracking distribution packages needed by tests;
|
||||
# see http://docs.openstack.org/infra/bindep/ for additional information.
|
||||
|
||||
# Need to build cryptography for installing ansible-lint
|
||||
build-essential [platform:dpkg]
|
||||
gcc [platform:rpm]
|
||||
libssl-dev [platform:dpkg]
|
||||
openssl [platform:brew]
|
||||
openssl-devel [platform:rpm]
|
||||
libffi [platform:brew]
|
||||
libffi-dev [platform:dpkg]
|
||||
libffi-devel [platform:rpm]
|
||||
python-dev [platform:dpkg]
|
||||
python-devel [platform:rpm !platform:centos-8]
|
||||
python3-devel [platform:centos-8]
|
||||
libre2-dev [compile test platform:dpkg]
|
||||
libre2-1v5 [platform:ubuntu-xenial]
|
||||
libre2-3 [platform:debian-stretch]
|
||||
libre2-4 [platform:ubuntu-bionic]
|
||||
# re2, re2-devel on centos 7/8 comes from EPEL which is not enabled by default
|
||||
re2-devel [compile test platform:rpm !platform:centos]
|
||||
re2-dev [platform:apk]
|
||||
re2 [platform:rpm platform:apk platform:brew !platform:centos !platform:opensuse]
|
@ -2,7 +2,6 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
flake8
|
||||
zuul; python_version > "3"
|
||||
|
||||
# We need to pin the ansible version directly here; per the
|
||||
# deprecation policy it should trail the version used by Zuul by 4
|
||||
|
6
tests/fake-ansible/library/zuul_console.py
Normal file
6
tests/fake-ansible/library/zuul_console.py
Normal file
@ -0,0 +1,6 @@
|
||||
# This is a fake zuul_return to make ansible-lint happy
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
return AnsibleModule()
|
12
tests/fake-ansible/library/zuul_return.py
Normal file
12
tests/fake-ansible/library/zuul_return.py
Normal file
@ -0,0 +1,12 @@
|
||||
# This is a fake zuul_return to make ansible-lint happy
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
data=dict(default=None),
|
||||
path=dict(default=None, type=str),
|
||||
file=dict(default=None, type=str),
|
||||
)
|
||||
)
|
10
tox.ini
10
tox.ini
@ -35,18 +35,14 @@ passenv =
|
||||
# see openstack-zuul-jobs-linters job for more information.
|
||||
ANSIBLE_ROLES_PATH
|
||||
setenv =
|
||||
ANSIBLE_LIBRARY= {envsitepackagesdir}/zuul/ansible/base/library
|
||||
ANSIBLE_ACTION_PLUGINS = {envsitepackagesdir}/zuul/ansible/base/actiongeneral
|
||||
ANSIBLE_LIBRARY= {toxinidir}/tests/fake-ansible
|
||||
whitelist_externals = bash
|
||||
commands =
|
||||
flake8 {posargs}
|
||||
# Ansible lint
|
||||
# [ANSIBLE0012] Commands should not change things if nothing needs doing
|
||||
# [204] Lines should be no longer than 160 chars
|
||||
bash -c "find playbooks -type f -regex '.*.ya?ml' ! -regex '.*vars\/.*' -print0 | \
|
||||
xargs -t -n1 -0 ansible-lint -xANSIBLE0012,204"
|
||||
xargs -t -n1 -0 ansible-lint"
|
||||
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
|
||||
xargs -t -n1 ansible-lint -xANSIBLE0012,204'
|
||||
xargs -t -n1 ansible-lint'
|
||||
# Ansible Syntax Check
|
||||
bash -c "find playbooks -type f -regex '.*.ya?ml' ! -regex '.*vars\/.*' -exec \
|
||||
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"
|
||||
|
Loading…
Reference in New Issue
Block a user