ansible-lint: re-enabled

Previously ansible-lint was running without any rules, so mainly as good
as not runnign at all. Renabling it required updating the list of skips,
but we will address these in follow-ups.

This also bumps ansible-lint to the master version which is not affected
by the installation bug.

Bug: https://bugs.launchpad.net/tripleo/+bug/1848512
Change-Id: I3e78dbf6d3a09aea9430a01e9553d31f8171235a
This commit is contained in:
Sorin Sbarnea 2019-10-23 11:35:58 +01:00
parent fdcf0c21dd
commit e702a6b97f
7 changed files with 20 additions and 18 deletions

View File

@ -1,18 +1,17 @@
exclude_paths: exclude_paths:
- roles/validate-ui/.travis.yml - roles/validate-ui/.travis.yml
# we don't want to see failures from sideloaded repos
- ../tripleo-upgrade/
parseable: true parseable: true
rulesdir:
- ./ci-scripts/ansible_rules/
quiet: false quiet: false
skip_list: skip_list:
- ANSIBLE0006 # Using command rather than module we have a few use cases # TODO(ssbarnea): Gradually remove these skips ASAP
# where we need to use curl and rsync - 204 # Lines should be no longer than 160 chars
- ANSIBLE0007 # Using command rather than an argument to e.g file - 206 # Variables should have spaces before and after: {{ var_name }}
# we have a lot of 'rm' command and we should use file module instead - 303 # sed used in place of template, replace or lineinfile module
- ANSIBLE0010 # Package installs should not use latest. - 504 # Do not use 'local_action', use 'delegate_to: localhost'
# Sometimes we need to update some packages. - 601 # Don't compare to literal True/False
- ANSIBLE0012 # Commands should not change things if nothing needs doing - 602 # Don't compare to empty string
- ANSIBLE0013 # Use Shell only when shell functionality is required - 701 # No 'galaxy_info' found
- ANSIBLE0016 # Tasks that run when changed should likely be handlers - 703 # Should change default metadata: author
# this requires refactoring roles, skipping for now
verbosity: 1 verbosity: 1

View File

@ -22,7 +22,7 @@ repos:
types: [file, yaml] types: [file, yaml]
entry: yamllint --strict -f parsable entry: yamllint --strict -f parsable
- repo: https://github.com/ansible/ansible-lint - repo: https://github.com/ansible/ansible-lint
rev: v4.1.1a0 rev: 0523c63f193d65313dcd743686d7fb0623a72ee8
hooks: hooks:
- id: ansible-lint - id: ansible-lint
files: \.(yaml|yml)$ files: \.(yaml|yml)$

View File

@ -41,6 +41,7 @@
ip link set dev eth2 mtu 1450; ip link set dev eth2 mtu 1450;
ping 10.0.0.1 -c 4 -q; ping 10.0.0.1 -c 4 -q;
become: true become: true
changed_when: false
- include_role: - include_role:
name: freeipa-setup name: freeipa-setup

View File

@ -49,7 +49,8 @@
tasks_from: package_installs tasks_from: package_installs
when: package_installs|default(true)|bool when: package_installs|default(true)|bool
- name: Update built packages - name: Update built packages
shell: "{{ ansible_pkg_mgr }} --enablerepo='gating-repo' update -y" shell: |
{{ ansible_pkg_mgr }} --enablerepo='gating-repo' update -y # noqa 305
become: true become: true
when: hostvars['undercloud']['compressed_gating_repo'] is defined when: hostvars['undercloud']['compressed_gating_repo'] is defined
tags: tags:

View File

@ -8,6 +8,7 @@
tasks: tasks:
- name: Host setup - name: Host setup
shell: > shell: >
set -eo pipefail;
echo "127.0.0.1 $(hostname) $(hostname).openstacklocal" | sudo tee -a /etc/hosts; echo "127.0.0.1 $(hostname) $(hostname).openstacklocal" | sudo tee -a /etc/hosts;
echo "127.0.0.2 undercloud undercloud.openstacklocal" | sudo tee -a /etc/hosts; echo "127.0.0.2 undercloud undercloud.openstacklocal" | sudo tee -a /etc/hosts;
if [ ! -e ${HOME}/.ssh/id_rsa.pub ] ; then if [ ! -e ${HOME}/.ssh/id_rsa.pub ] ; then
@ -24,6 +25,7 @@
sudo cp {{tripleo_root}}/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/; sudo cp {{tripleo_root}}/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/;
sudo update-ca-trust extract; sudo update-ca-trust extract;
cp -f {{ lookup('env', 'TE_DATAFILE') }} ~/instackenv.json; cp -f {{ lookup('env', 'TE_DATAFILE') }} ~/instackenv.json;
changed_when: true
- name: Correct the driver for newer releases - name: Correct the driver for newer releases
# TODO(dtantsur): remove when Pike is not supported # TODO(dtantsur): remove when Pike is not supported
@ -47,5 +49,5 @@
- name: Install ipmitool if not installed - name: Install ipmitool if not installed
package: package:
name: ipmitool name: ipmitool
state: latest state: latest # noqa 403
become: true become: true

View File

@ -18,7 +18,8 @@
- when: get_build_command is defined - when: get_build_command is defined
block: block:
- name: execute build_command - name: execute build_command
shell: "echo {{ get_build_command }}" shell: |
echo {{ get_build_command }} # noqa 305
register: build_command_output register: build_command_output
tags: tags:
- undercloud-install - undercloud-install

View File

@ -41,8 +41,6 @@ commands = bash -c ci-scripts/releasenotes_tox.sh
[testenv:linters] [testenv:linters]
basepython = python3 basepython = python3
deps = deps =
# workaround for https://github.com/ansible/ansible-lint/issues/590
virtualenv==16.3.0 # 16.7.6 not working
jinja2 jinja2
pre-commit pre-commit
commands = commands =