]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
travis: fail on ansible-lint errors
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 21 Oct 2019 14:03:08 +0000 (10:03 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 21 Oct 2019 19:55:54 +0000 (15:55 -0400)
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 <dsavinea@redhat.com>
(cherry picked from commit 3969470fca995f7297d2e8516ea3bf9b287da1f8)

.travis.yml
roles/ceph-rbd-mirror/tasks/configure_mirroring.yml

index 4d25b525125f1a3023631835ba58bc28ee038bd7..73c331db8c844f20138cab3c1fc113b11286f919 100644 (file)
@@ -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
index 8dc4d7ec163623827972e3f3ae328c591e1398b8..4da988c1bd02c323efc4b77e771d09c182615eb7 100644 (file)
@@ -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