Use a fake zuul_return and 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 to fake out ansible-lint. Change-Id: I40291d4e861fe9e6e3341b075ab7d6c9f5315275
This commit is contained in:
parent
7b10451785
commit
9a49d142b2
10
.ansible-lint
Normal file
10
.ansible-lint
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
exclude_paths:
|
||||||
|
- playbooks/legacy
|
||||||
|
parseable: true
|
||||||
|
# [301] Commands should not change things if nothing needs doing
|
||||||
|
# [306] shells with pipe should use pipe
|
||||||
|
skip_list:
|
||||||
|
- '301'
|
||||||
|
- '306'
|
||||||
|
use_default_rules: true
|
||||||
|
verbosity: 1
|
16
bindep.txt
16
bindep.txt
@ -1,16 +0,0 @@
|
|||||||
# This is a cross-platform list tracking distribution packages needed by tests;
|
|
||||||
# see http://docs.openstack.org/infra/bindep/ for additional information.
|
|
||||||
|
|
||||||
libffi-devel [test platform:rpm]
|
|
||||||
libffi-dev [test platform:dpkg]
|
|
||||||
libssl-dev [platform:dpkg]
|
|
||||||
openssl-devel [platform:rpm]
|
|
||||||
python3-dev [compile test platform:dpkg platform:apk]
|
|
||||||
python3-devel [compile test platform:rpm]
|
|
||||||
libre2-dev [compile test platform:dpkg]
|
|
||||||
libre2-4 [platform:ubuntu-bionic]
|
|
||||||
libre2-3 [platform:debian-stretch]
|
|
||||||
libre2-1v5 [platform:ubuntu-xenial]
|
|
||||||
re2-devel [compile test platform:rpm]
|
|
||||||
re2-dev [platform:apk]
|
|
||||||
re2 [platform:rpm platform:apk]
|
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
hacking>=2.0.0,<2.1 # Apache-2.0
|
hacking>=2.0.0,<2.1 # Apache-2.0
|
||||||
|
|
||||||
zuul
|
|
||||||
ansible>=2.7.0,<2.8
|
ansible>=2.7.0,<2.8
|
||||||
ansible-lint>=4,<=5
|
ansible-lint>=4,<=5
|
||||||
bashate>=0.2
|
bashate>=0.2
|
||||||
|
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
@ -30,18 +30,14 @@ passenv =
|
|||||||
# see openstack-zuul-jobs-linters job for more information.
|
# see openstack-zuul-jobs-linters job for more information.
|
||||||
ANSIBLE_ROLES_PATH
|
ANSIBLE_ROLES_PATH
|
||||||
setenv =
|
setenv =
|
||||||
ANSIBLE_LIBRARY= {envsitepackagesdir}/zuul/ansible/base/library
|
ANSIBLE_LIBRARY= {toxinidir}/tests/fake-ansible
|
||||||
ANSIBLE_ACTION_PLUGINS = {envsitepackagesdir}/zuul/ansible/base/actiongeneral
|
|
||||||
commands =
|
commands =
|
||||||
flake8 {posargs}
|
flake8 {posargs}
|
||||||
# Ansible lint
|
|
||||||
# [301] Commands should not change things if nothing needs doing
|
|
||||||
# [306] shells with pipe should use pipe
|
|
||||||
bash -c "find playbooks -type d -name "legacy" -prune -o \
|
bash -c "find playbooks -type d -name "legacy" -prune -o \
|
||||||
-type f -regex '.*.y[a]ml' -print0 | xargs -t -n1 -0 \
|
-type f -regex '.*.y[a]ml' -print0 | xargs -t -n1 -0 \
|
||||||
ansible-lint -x301,306"
|
ansible-lint"
|
||||||
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
|
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
|
||||||
xargs -t -n1 ansible-lint -x301,306'
|
xargs -t -n1 ansible-lint'
|
||||||
# Ansible Syntax Check
|
# Ansible Syntax Check
|
||||||
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \
|
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \
|
||||||
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"
|
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"
|
||||||
|
Loading…
Reference in New Issue
Block a user