From 74d237a3f729069773e2fafb68a6531b15b03df1 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Tue, 18 Jul 2017 10:48:54 -0400 Subject: [PATCH] Rework tox -e linters Move our syntax-check to be first, logic being if we have bad syntax and ansible-lint will most likely fail. Clean our redirects to only output failures. It would be nice is ansible-playbook / ansible-lint could use the same redirects, but sadly they cannot. Change-Id: Ia3c5966d60d28b81e2f2c6a446116bb37df6ab23 Signed-off-by: Paul Belanger --- tox.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index ed7e6dd19..676a4ef5a 100644 --- a/tox.ini +++ b/tox.ini @@ -26,14 +26,14 @@ setenv = whitelist_externals = bash commands = flake8 {posargs} + # Ansible Syntax Check + bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -n1 -0 \ + ansible-playbook --syntax-check -i tests/inventory 1>/dev/null" # Ansible Lint Check # NOTE(pabelanger): Ignore the following checks: # ANSIBlE0012: Commands should not change things if nothing needs doing - bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ - ansible-lint -x ANSIBLE0012" - # Ansible Syntax Check - bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ - ansible-playbook --syntax-check -i tests/inventory > /dev/null" + bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -n1 -0 \ + ansible-lint -x ANSIBLE0012 2> /dev/null" [testenv:venv] commands = {posargs}