Bug Report: LVM role conditional evaluates to string instead of boolean
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- ansible
- Domain
- devops
Research direction
Start at ansible/roles/lvm/tasks/manage_lvm.yml line 10 and inspect the "Rescan LVM Volume Groups" task and its when condition. Reproduce the case with the LVM filter variables undefined, then verify that the condition evaluates as a boolean and that the task behaves correctly without the host_vars workaround.
Written by the indexing model from the issue text.
Description
**Bug Report: LVM role conditional evaluates to string instead of boolean**
**File:** `ansible/roles/lvm/tasks/manage_lvm.yml`
**Line:** 10
**Problem:**
The `when` condition in the "Rescan LVM Volume Groups" task:
```yaml
when: ((lvm__register_devices_filter | d() and lvm__register_devices_filter is changed) or
(lvm__register_devices_global_filter | d() and lvm__register_devices_global_filter is changed))
Can fail with:
Conditional result (False) was derived from value of type 'str'
Root Cause:
When lvm__register_devices_filter is undefined, | d() returns an empty string.
The expression lvm__register_devices_filter | d() and ... evaluates to a string,
not a boolean.
Suggested Fix:
when: ((lvm__register_devices_filter is defined and lvm__register_devices_filter.changed) or
(lvm__register_devices_global_filter is defined and lvm__register_devices_global_filter.changed))
Workaround:
Users can pre-define these variables in host_vars:
lvm__register_devices_filter:
changed: false
lvm__register_devices_global_filter:
changed: false
Environment:
- DebOps version: 3.3.0
- Ansible core: 2.21.2
- Python: 3.12
- Dominant language
- Jinja
- Stars
- 1.4k
- Forks
- 379
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from debops/debops
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
repo:raw-data
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
hotosm/raw-data-api#316 · 1 comment ·
-
agentic-workflows cascade-suspected
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
willow
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openedx/openedx-authz#460 ·