[LINTERS] Fix ansible-lint.sh and lint issues

This patch fixes lint issues that ansible-lint.sh did let pass and it enables
the verbose mode to see what happens.

Change-Id: Id912ecb4000a4cfeb8a4b8ab631774fd7ea5a449
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2017-03-08 10:45:17 +01:00
parent 1d1f611486
commit 00d8fe4062
2 changed files with 12 additions and 17 deletions

View File

@ -12,18 +12,10 @@
# this requires refactoring roles, skipping for now
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
function lint_error_check {
local rc=$?
lint_error=0
[ $rc -eq 2 ] && lint_error=1
return $lint_error
}
# lint the playbooks separately to avoid linting the roles multiple times
pushd playbooks
for playbook in `find . -type f -regex '.*\.y[a]?ml' -print0`; do
ansible-lint -x $SKIPLIST $playbook
lint_error_check
ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1
done
popd
@ -31,11 +23,11 @@ popd
# 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.
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
ansible-lint -x $SKIPLIST $rolesdir/
lint_error_check
ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1
done
# exit with 1 if we had a least an error or warning.
if [[ "$lint_error" != 0 ]]; then
## exit with 1 if we had a least an error or warning.
if [[ -n "$lint_error" ]]; then
exit 1;
fi

View File

@ -63,10 +63,12 @@
modify_image_extract_list: "{{ image_build_extract_list }}"
rescue:
- set_fact: image_build_failed=true
- name: Set image_build_failed fact
set_fact: image_build_failed=true
always:
- shell: |
- name: Displaying log files from build isolation image
shell: |
virt-cat -a {{ build_isolation_image.name }}.qcow2 \
/tmp/builder.log > builder.log 2>&1 || true
virt-cat -a {{ build_isolation_image.name }}.qcow2 \
@ -84,7 +86,8 @@
# because even though the fail was executed it did not actually cause ansible to
# exit with nonzero. I suspect it is some interaction with block, so moving the
# actual fail out of the block.
- fail: msg='*** Image Build Error ***'
- name: Throw error msg if image build is failing
fail: msg='*** Image Build Error ***'
when: image_build_failed|default(false)|bool
- when: build_undercloud|bool
@ -150,4 +153,4 @@
shell: >-
rm -rf {{ images_working_dir }}/overcloud-full.d {{ images_working_dir }}/ironic-python-agent.d/
sudo chown $USER: {{ images_working_dir }}/overcloud-full.* {{ images_working_dir }}/ironic-python-agent.*
when: cleanup_images_working_dir| bool
when: cleanup_images_working_dir| bool