Commit 2d118cb
committed
Evaluate confine block in case-insensitive way
Prior to this commit when a user provided a confine block, Facter would
downcase the value when evaluating it.
For example:
confine :kernel do |value|
value == "Linux"
end
While Facter's public documentation states that this is a valid way to
write a confine block, it would incorrectly and unexpectedly evaluate
as false on Linux systems.
However, these other styles of confine would return true:
confine :kernel => "Linux"
confine kernel: "Linux"
This downcasing behavior was introduced in 7a81945 as a way of comparing
values in a case-insensitive way. However when block confines were
introduced in e4c8689, it added block evaluation before value
comparison, making the case-insensitive comparison moot with blocks.
This commit retains existing behavior of evaluating a confine block with
a downcased fact value, while adding evaluation with the raw fact value
to ensure expected behavior.1 parent 5335371 commit 2d118cb
File tree
2 files changed
+18
-2
lines changed- lib/facter/custom_facts/util
- spec/custom_facts/util
2 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
129 | 143 | | |
130 | 144 | | |
131 | 145 | | |
| |||
0 commit comments