From 477907dd724e6f6c549d860079682e9c4702c442 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Wed, 18 Mar 2020 01:22:37 +0000 Subject: [PATCH] Add yaml and ansible linters Before we get too carried away, let's add some linters. This commit also fixes some linting failures in tripleo_ipa/meta/main.yml. Change-Id: Ic57d1b84a90ce5456812b9462c1af5539791b561 --- test-requirements.txt | 2 ++ tox.ini | 19 ++++++++++++++++++- tripleo_ipa/meta/main.yml | 22 +++++++--------------- 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..4c2b5be --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +ansible-lint +yamllint diff --git a/tox.ini b/tox.ini index a11cf20..15116d2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] minversion = 2.0 # add docs to the list of environments once we actually have docs to generate -envlist = molecule +envlist = molecule, linters skipdist = True [testenv] @@ -15,3 +15,20 @@ changedir = {toxinidir}/tripleo_ipa commands = molecule test --all whitelist_externals = tox + +[testenv:ansible-lint] +deps = {[testenv:linters]deps} +commands = + ansible-lint {toxinidir}/tripleo_ipa + +[testenv:yamllint] +deps = {[testenv:linters]deps} +commands = + yamllint -c {toxinidir}/tripleo_ipa/.yamllint {toxinidir}/tripleo_ipa + +[testenv:linters] +deps = + -r {toxinidir}/test-requirements.txt +commands = + {[testenv:ansible-lint]commands} + {[testenv:yamllint]commands} diff --git a/tripleo_ipa/meta/main.yml b/tripleo_ipa/meta/main.yml index 4d371b7..639e13c 100644 --- a/tripleo_ipa/meta/main.yml +++ b/tripleo_ipa/meta/main.yml @@ -1,7 +1,7 @@ galaxy_info: - author: your name - description: your role description - company: your company (optional) + author: OpenStack + description: This role is used to integrate TripleO with FreeIPA. + company: Red Hat # If the issue tracker for your role is not on github, uncomment the # next line and provide a value @@ -27,17 +27,10 @@ galaxy_info: # To view available platforms and versions (or releases), visit: # https://galaxy.ansible.com/api/v1/platforms/ # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 + platforms: + - name: CentOS + versions: + - 8 galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes @@ -50,4 +43,3 @@ galaxy_info: dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, # if you add dependencies to this list. -