]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commit
ceph-facts: Fix get_def_crush_rule_name.yml in check mode
authorBenoît Knecht <bknecht@protonmail.ch>
Mon, 13 Dec 2021 15:36:27 +0000 (16:36 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 16 Feb 2022 08:50:24 +0000 (09:50 +0100)
commitdf0901e8799c289f10e312a964b162fe10768b2a
tree538cc51f353955bcb4dc232fcecdcfddb735a207
parent9675e146ee4f4b6162adf6d5d5b995dafcbeafde
ceph-facts: Fix get_def_crush_rule_name.yml in check mode

This construct doesn't work as intended since ansible/ansible#74212:

```
item.stdout | default('{}') | from_json
```

That PR made the `command` module return `stdout` even in check mode (setting
it to the empty string), so `default()` has no effect in that case and
`from_json()` fails to parse an empty string.

Instead, `default()` needs to be invoked with its second argument set to
`True`, so that it replaces any `False` value (such as an empty string) with
its first argument:

```
item.stdout | default('{}', True) | from_json
```

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit 7684d892c083ea1e07ada163e78da9f0359b116f)
roles/ceph-facts/tasks/get_def_crush_rule_name.yml