Cap ansible at <2.10 and fix hacking. Additionally convert ansible-lint
to not use the old shell script and use .ansible-lint for skips

Change-Id: I035ed9f3964ba904dc9ccfe048b69a68c6680253
This commit is contained in:
Alex Schultz 2021-02-20 16:29:26 -07:00
parent ca1fcceeb3
commit c6f9a7bdd7
7 changed files with 16 additions and 45 deletions

8
.ansible-lint Normal file
View File

@ -0,0 +1,8 @@
skip_list: # or 'skip_list' to silence them completely
- command-instead-of-shell # Use shell only when shell functionality is required
- experimental # all rules tagged as experimental
- no-changed-when # Commands should not change things if nothing needs doing
- no-handler # Tasks that run when changed should likely be handlers
- package-latest # Package installs should not use latest
- role-name # Role name {0} does not match ``^[a-z][a-z0-9_]+$`` pattern

View File

@ -2,5 +2,5 @@
# to licensing conflicts. But we sill need to be able to pull them in for
# lint checks and want to document these as ansible specific things that may
# be required for this repository.
ansible
ansible<2.10
ansible-lint

View File

@ -1,36 +0,0 @@
#!/bin/bash
# 303: Using command rather than module
# we have a few use cases where we need to use curl and rsync
# 503: Tasks that run when changed should likely be handlers
# this requires refactoring roles, skipping for now
# 301: Commands should not change things if nothing needs doing
# this requires refactoring roles, skipping for now
# 106: Role name {} does not match ^[a-z][a-z0-9_]+$ pattern
# this isn't in a collection and we'd need to maintain backwards compat
SKIPLIST="303,503,301,106"
# lint the playbooks separately to avoid linting the roles multiple times
for DIR in tasks playbooks; do
if [ -d "$DIR" ]; then
pushd $DIR
for playbook in `find . -type f -regex '.*\.y[a]?ml'`; do
ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1
done
popd
fi
done
# lint all the possible roles
# Due to https://github.com/willthames/ansible-lint/issues/210, the roles
# directories need to contain a trailing slash at the end of the path.
if [ -d ./roles ]; then
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1
done
fi
# exit with 1 if we had a least an error or warning.
if [[ -n "$lint_error" ]]; then
exit 1;
fi

View File

@ -1,8 +1,6 @@
galaxy_info:
author:
- Sam Doran
- David Critch
- Emilien Macchi
role_name: redhat-subscription
author: tripleo
description: "Manage Red Hat subscription and repositories."
company:
license: Apache 2.0
@ -13,6 +11,7 @@ galaxy_info:
versions:
- 6
- 7
- 8
galaxy_tags:
- system

View File

@ -50,6 +50,7 @@
section: main
option: proxy
value: "{{ rhsm_rhsm_proxy_proto | default('http') }}://{{ rhsm_rhsm_proxy_hostname }}:{{ rhsm_rhsm_proxy_port }}"
mode: 0644
tags:
- rhsm
- rhsm_conf

View File

@ -1,3 +1,3 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=4.0.0,<4.1.0 # Apache-2.0
bashate>=0.5.1 # Apache-2.0
pyflakes>=2.2.0

View File

@ -39,9 +39,8 @@ commands =
| xargs flake8 --verbose"
[testenv:ansible-lint]
basepython=python3
commands =
bash ci-scripts/ansible-lint.sh
basepython = python3
commands = ansible-lint
[testenv:linters]
basepython = python3