[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:
parent
1d1f611486
commit
00d8fe4062
@ -12,18 +12,10 @@
|
|||||||
# this requires refactoring roles, skipping for now
|
# this requires refactoring roles, skipping for now
|
||||||
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
|
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
|
# lint the playbooks separately to avoid linting the roles multiple times
|
||||||
pushd playbooks
|
pushd playbooks
|
||||||
for playbook in `find . -type f -regex '.*\.y[a]?ml' -print0`; do
|
for playbook in `find . -type f -regex '.*\.y[a]?ml' -print0`; do
|
||||||
ansible-lint -x $SKIPLIST $playbook
|
ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1
|
||||||
lint_error_check
|
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -31,11 +23,11 @@ popd
|
|||||||
# Due to https://github.com/willthames/ansible-lint/issues/210, the 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.
|
# directories need to contain a trailing slash at the end of the path.
|
||||||
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
|
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
|
||||||
ansible-lint -x $SKIPLIST $rolesdir/
|
ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1
|
||||||
lint_error_check
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# exit with 1 if we had a least an error or warning.
|
## exit with 1 if we had a least an error or warning.
|
||||||
if [[ "$lint_error" != 0 ]]; then
|
if [[ -n "$lint_error" ]]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -63,10 +63,12 @@
|
|||||||
modify_image_extract_list: "{{ image_build_extract_list }}"
|
modify_image_extract_list: "{{ image_build_extract_list }}"
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- set_fact: image_build_failed=true
|
- name: Set image_build_failed fact
|
||||||
|
set_fact: image_build_failed=true
|
||||||
|
|
||||||
always:
|
always:
|
||||||
- shell: |
|
- name: Displaying log files from build isolation image
|
||||||
|
shell: |
|
||||||
virt-cat -a {{ build_isolation_image.name }}.qcow2 \
|
virt-cat -a {{ build_isolation_image.name }}.qcow2 \
|
||||||
/tmp/builder.log > builder.log 2>&1 || true
|
/tmp/builder.log > builder.log 2>&1 || true
|
||||||
virt-cat -a {{ build_isolation_image.name }}.qcow2 \
|
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
|
# 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
|
# exit with nonzero. I suspect it is some interaction with block, so moving the
|
||||||
# actual fail out of the block.
|
# 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: image_build_failed|default(false)|bool
|
||||||
|
|
||||||
- when: build_undercloud|bool
|
- when: build_undercloud|bool
|
||||||
|
Loading…
Reference in New Issue
Block a user