diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 000000000..97e045512 --- /dev/null +++ b/.ansible-lint @@ -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 diff --git a/bindep.txt b/bindep.txt deleted file mode 100644 index 527c86f6b..000000000 --- a/bindep.txt +++ /dev/null @@ -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] diff --git a/test-requirements.txt b/test-requirements.txt index d7b880850..2e3e93fb6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tests/fake-ansible/library/zuul_console.py b/tests/fake-ansible/library/zuul_console.py new file mode 100644 index 000000000..a7fc8477c --- /dev/null +++ b/tests/fake-ansible/library/zuul_console.py @@ -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() diff --git a/tests/fake-ansible/library/zuul_return.py b/tests/fake-ansible/library/zuul_return.py new file mode 100644 index 000000000..48f8c9155 --- /dev/null +++ b/tests/fake-ansible/library/zuul_return.py @@ -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), + ) + ) diff --git a/tox.ini b/tox.ini index e1930438d..b10fad675 100644 --- a/tox.ini +++ b/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"