]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
shrink-osd: various fixes
authorBenoît Knecht <bknecht@protonmail.ch>
Tue, 28 Jul 2020 11:47:26 +0000 (13:47 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 6 Aug 2020 11:10:42 +0000 (13:10 +0200)
This handles missing /etc/ceph/osd, by ensuring we actually found files in
`/etc/ceph/osd` before trying to slurp their content.

This also add a missing `| default(False)` to avoid fowlloing error:

```
fatal: [ceph01]: FAILED! =>
  msg: |-
    The conditional check 'ceph_osd_data_json[item.2]['encrypted'] | bool' failed. The error was: error while evaluating conditional (ceph_osd_data_json[item.2]['encrypted'] | bool): 'dict object' has no attribute 'encrypted'
```

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1862416
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit fe8fbd3ee2d877c9ca3b08412a8b12f64a111c18)

infrastructure-playbooks/shrink-osd.yml

index 68aeb9a06c431abd021493be4032c0757dcc2ac4..23ab07cf380204b7f535638a0d8354b0c0b6974e 100644 (file)
       delegate_to: "{{ item.item.0 }}"
       register: ceph_osd_files_content
       loop: "{{ ceph_osd_data.results }}"
-      when: item.skipped is undefined
+      when:
+        - item.skipped is undefined
+        - item.matched > 0
 
     - name: set_fact ceph_osd_files_json
       set_fact:
       until: result is succeeded
       when:
         - item.2 not in _lvm_list.keys()
-        - ceph_osd_data_json[item.2]['encrypted'] | bool
+        - ceph_osd_data_json[item.2]['encrypted'] | default(False) | bool
         - ceph_osd_data_json[item.2][item.3] is defined
 
     - name: use ceph-volume lvm zap to destroy all partitions