From c0c9653ab5a46289ca55ca9f7025551843e8d63e Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 14 Jul 2017 16:51:59 -0400 Subject: [PATCH] Ensure we load roles for linting Did didn't have ansible-lint setup properly, as a results our roles weren't actually linted properly. Switch run-docs to command task, since we are not using any shell variables. Ignore ANSIBLE0012 for now. Change-Id: Id184f7eb5dd67117e7dde9c8eb38a3a8af9dd892 Signed-off-by: Paul Belanger --- roles/run-docs/tasks/main.yaml | 2 +- tests/ansible.cfg | 2 ++ tox.ini | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/ansible.cfg diff --git a/roles/run-docs/tasks/main.yaml b/roles/run-docs/tasks/main.yaml index 39668a62..dce70911 100644 --- a/roles/run-docs/tasks/main.yaml +++ b/roles/run-docs/tasks/main.yaml @@ -1,4 +1,4 @@ - name: Execute run-docs.sh. - shell: "/usr/local/jenkins/slave_scripts/run-docs.sh {{ tox_envlist }}" + command: "/usr/local/jenkins/slave_scripts/run-docs.sh {{ tox_envlist }}" args: chdir: "{{ zuul_work_dir }}" diff --git a/tests/ansible.cfg b/tests/ansible.cfg new file mode 100644 index 00000000..51d344dc --- /dev/null +++ b/tests/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +roles_path = ../roles diff --git a/tox.ini b/tox.ini index 7afd70be..f4086d9c 100644 --- a/tox.ini +++ b/tox.ini @@ -21,11 +21,16 @@ commands = bindep test commands = python setup.py build_sphinx [testenv:pep8] +setenv = + ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg whitelist_externals = bash commands = flake8 {posargs} + # 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" + ansible-lint -x ANSIBLE0012" [testenv:venv] commands = {posargs}