]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commit
ceph_volume: fix bug in `is_lv()`
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 22 Mar 2021 13:46:55 +0000 (14:46 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 24 Mar 2021 08:20:24 +0000 (09:20 +0100)
commit3c5f5f1503240aac587f8659cb65e9bd7715d05a
tree2ff911535ec33529a5f9ca1b83be0e64e714a219
parentbe7cfb9ccc2d5918d7b8a541a155921288eea6a8
ceph_volume: fix bug in `is_lv()`

This function makes the `ceph_volume` module be not idempotent in
containerized context because it tries to run a container and bindmount
directories that no longer exist.

In that case, the `lvs` command being executed returns something
different than `0` so we can't call `json.loads(out)['report'][0]['lv']`
since it might throw an python error.

The idea is to return `True` only if `rc` is equal to `0` and
`len(result)` is greater than `0`, which means the command matched an
LV.

Fixes: #6284
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit ed79bc7a4e38e257f37faac50a5a19c06711dd8d)
library/ceph_volume.py