From: Dimitri Savineau Date: Mon, 21 Oct 2019 14:03:08 +0000 (-0400) Subject: travis: fail on ansible-lint errors X-Git-Tag: v4.0.3~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c787cfcdff2d20e12e5e9f6d810f3ed460051a4d;p=ceph-ansible.git travis: fail on ansible-lint errors If ansible-lint reports an error then it's skipped. We should fail in this case. This patch also fixes the pipefail lint in the rbd mirror role [306] Shells that use pipes should set the pipefail option Signed-off-by: Dimitri Savineau (cherry picked from commit 3969470fca995f7297d2e8516ea3bf9b287da1f8) --- diff --git a/.travis.yml b/.travis.yml index 4d25b5251..73c331db8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ install: script: - if [[ -n $(grep --exclude-dir=.git -P "\xa0" -r .) ]]; then echo 'NBSP characters found'; exit 1; fi - pytest -vvvv library/ plugins/ - - for i in $(ls -1 roles/); do ANSIBLE_LOG_PATH=/dev/null ansible-lint -x 204 -v roles/$i/ ; done + - for i in $(ls -1 roles/); do ANSIBLE_LOG_PATH=/dev/null ansible-lint -x 204 -v roles/$i/; if [ $? -ne 0 ]; then exit 1; fi; done diff --git a/roles/ceph-rbd-mirror/tasks/configure_mirroring.yml b/roles/ceph-rbd-mirror/tasks/configure_mirroring.yml index 8dc4d7ec1..4da988c1b 100644 --- a/roles/ceph-rbd-mirror/tasks/configure_mirroring.yml +++ b/roles/ceph-rbd-mirror/tasks/configure_mirroring.yml @@ -4,12 +4,11 @@ changed_when: false - name: list mirroring peer - shell: "{{ container_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool info {{ ceph_rbd_mirror_pool }} | grep -q {{ ceph_rbd_mirror_remote_user }}" + command: "{{ container_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool info {{ ceph_rbd_mirror_pool }}" changed_when: false - failed_when: false register: mirror_peer - name: add a mirroring peer command: "{{ container_exec_cmd | default('') }} rbd --cluster {{ cluster }} --keyring /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring --name client.rbd-mirror.{{ ansible_hostname }} mirror pool peer add {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_remote_user }}@{{ ceph_rbd_mirror_remote_cluster }}" changed_when: false - when: mirror_peer.rc == 1 + when: ceph_rbd_mirror_remote_user in mirror_peer.stdout