Who found the bug? Me. Sorry, I am new to ruby, but I believe I understand what it is I'm trying to do and what is going wrong. Where was the bug found?
- System: Developing in a docker
- Version: 4.2.12
- Operating system(s): Linux
- Puppet version: 7.19.0
What is malfunctioning? According to the documentation, when wring custom facts, there are 3 ways to confine:
- confine :kernel => "Linux"
As I understand this it calls {{confine }}with a hashmap as an argument. So I assume confine matches based on that.
- confine kernel: "Linux"
As I understand this, it calls confine using the argument names kernel with the value "Linux". So I assume confine matches based on that.
- The third method is calling confine as an do iterable I think?
confine :kernel do |value| value == "Linux" end Unfortunately it is this third method that does not work. This exact example comes straight out of https://puppet.com/docs/puppet/7/fact_overview.html#writing_structured_facts
After adding numerous puts's, I was able to figure out what was going on. For some reason, the third method was incorrectly lowercasing the value, so it was linux instead of Linux. This is both surprising, and unnecessary. The currently documented way is the most logical and consistent way, but not how it worked. Facter.value(:kernel) is also the correct case: Linux What does success look like? confine :kernel do |value| value == "Linux" end Should work exactly like the others How will success be validated? confine :kernel do |value| value == "Linux" end Working{} Should anyone be contacted after this is fixed? Just this ticket |