From 665704e3dc58ca0afcca4dd65181522b5e12f883 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 28 Mar 2018 23:22:10 +0200 Subject: [PATCH] Fix ansible-lint job The ansible-linter was only running on playbooks, not on roles. This patch corrects the tox environment to ensure that roles are linted. Since roles weren't being linted, some errors had sneaked through. This patch also corrects an unnamed task and disables linting of a task that deliberately uses the shell module. Also fix a comment in the tox file that was referencing a non-existent zuul job. Change-Id: I5b1ca3947e80588ab0cc8d3632f1292fc707aac1 --- roles/configure-swap/tasks/ephemeral.yaml | 5 ++++- tox.ini | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/configure-swap/tasks/ephemeral.yaml b/roles/configure-swap/tasks/ephemeral.yaml index 7ec125a9..e800e32f 100644 --- a/roles/configure-swap/tasks/ephemeral.yaml +++ b/roles/configure-swap/tasks/ephemeral.yaml @@ -2,7 +2,8 @@ # Configure attached ephemeral devices for storage and swap -- assert: +- name: Assert that ephemeral_device is defined + assert: that: - "ephemeral_device is defined" @@ -106,6 +107,8 @@ mount {{ opt_partition }} /mnt find /opt/ -mindepth 1 -maxdepth 1 -exec mv {} /mnt/ \; umount /mnt + tags: + - skip_ansible_lint # This overmounts any existing /opt - name: Add opt to fstab and mount diff --git a/tox.ini b/tox.ini index 1097ece3..4e9936d5 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ whitelist_externals = bash passenv = # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need # to export ANSIBLE_ROLES_PATH pointing to the currect repos. - # see infra-zuul-jobs-linters job for more information. + # see openstack-zuul-jobs-linters job for more information. ANSIBLE_ROLES_PATH commands = flake8 {posargs} @@ -35,6 +35,8 @@ commands = bash -c "find playbooks -type d -name "legacy" -prune -o \ -type f -regex '.*.y[a]ml' -print0 | xargs -t -n1 -0 \ ansible-lint -xANSIBLE0012" + bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \ + xargs -t -n1 ansible-lint -xANSIBLE0012' # Ansible Syntax Check bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \ ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"