Skip to content

Commit

Permalink
shrink-osd: various fixes
Browse files Browse the repository at this point in the history
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 fe8fbd3)
  • Loading branch information
BenoitKnecht authored and guits committed Aug 6, 2020
1 parent 92a2a2c commit ccefe7d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions infrastructure-playbooks/shrink-osd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@
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:
Expand Down Expand Up @@ -191,7 +193,7 @@
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
Expand Down

0 comments on commit ccefe7d

Please sign in to comment.