Merge "Use a zuul_* and add an .ansible-lint file"

This commit is contained in:
Zuul 2020-03-17 15:40:23 +00:00 committed by Gerrit Code Review
commit bf5aad957a
6 changed files with 31 additions and 31 deletions

10
.ansible-lint Normal file
View 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

View File

@ -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]

View File

@ -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

View 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()

View 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
View File

@ -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"