Skip to content

Commit 79b449c

Browse files
committed
Add comments explaining json_query()
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
1 parent 98617ec commit 79b449c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tasks/main-blivet.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
- name: Apply defaults to pools and volumes [4/6]
5353
set_fact:
54+
# json_query(...) used instead of "|selectattr('pool', 'equalto', item.name)|list"
55+
# as that expression wouldn't work with Jinja versions <2.8
5456
_storage_vols_no_defaults_by_pool: "{{ _storage_vols_no_defaults_by_pool|default({})|
5557
combine({item.name: _storage_vols_w_defaults|json_query('[?pool==`\"{}\"`]'.format(item.name))}) }}"
5658
loop: "{{ _storage_pools }}"

tests/test-verify-volume-mount.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
- name: Set some facts
33
set_fact:
4+
# json_query(...) used instead of "|selectattr('device', 'equalto', storage_test_volume._device)|list"
5+
# as that expression wouldn't work with Jinja versions <2.8
46
storage_test_mount_device_matches: "{{ ansible_mounts|json_query('[?device==`\"{}\"`]'.format(storage_test_volume._device))}}"
57
storage_test_mount_point_matches: "{{ ansible_mounts|json_query('[?mount==`\"{}\"`]'.format(storage_test_volume.mount_point))}}"
68
storage_test_mount_expected_match_count: "{{ 1 if _storage_test_volume_present and storage_test_volume.mount_point else 0 }}"

0 commit comments

Comments
 (0)