Add tox.ini and ansible-lint cleanup

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-11-20 17:00:24 -05:00
parent f367b9a838
commit 7284ca30ac
6 changed files with 43 additions and 6 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.tox/

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
ansible

View File

@ -10,7 +10,7 @@
dest: /var/lib/zuul/.ssh
group: zuul
mode: 0700
owner: zuul
owner: zuul
state: directory
- name: Create ssh known hosts.
@ -19,7 +19,7 @@
dest: /var/lib/zuul/.ssh/known_hosts
group: zuul
mode: 0600
owner: zuul
owner: zuul
- name: Create ssh private key.
copy:
@ -27,12 +27,12 @@
dest: /var/lib/zuul/.ssh/id_rsa
group: zuul
mode: 0600
owner: zuul
owner: zuul
- name: Create required directories.
file:
group: zuul
owner: zuul
owner: zuul
path: "{{ item }}"
state: directory
with_items:

View File

@ -1,11 +1,11 @@
---
- name: Install zuul using pip.
pip:
name: zuul
name: zuul
when: zuul_pip_version is none
- name: Install zuul using pip.
pip:
name: zuul
name: zuul
version: "{{ zuul_pip_version }}"
when: zuul_pip_version is not none

2
test-requirements.txt Normal file
View File

@ -0,0 +1,2 @@
ansible-lint
hacking<0.11,>=0.10

33
tox.ini Normal file
View File

@ -0,0 +1,33 @@
[tox]
minversion = 1.6
envlist = ansible-lint,pep8
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:ansible-lint]
setenv =
ANSIBLE_CONFIG = tests/ansible.cfg
whitelist_externals = bash
commands =
bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
ansible-lint"
bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \
ansible-playbook --syntax-check -i tests/inventory \
-e rolename=$(basename $(pwd)) > /dev/null"
[testenv:ansible-functional]
commands =
ansible-playbook -i tests/inventory tests/test.yaml
passenv = HOME
setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}