Jira (FACT-3156) confine iterable incorrectly lowercases the value

4 views
Skip to first unread message

Andy Neff (Jira)

unread,
Oct 6, 2022, 5:31:03 PM10/6/22
to puppe...@googlegroups.com
Andy Neff updated an issue
 
Facter / Bug FACT-3156
confine iterable incorrectly lowercases the value
Change By: Andy Neff
Summary: confine iterable is incorrectly lowercases the value
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Andy Neff (Jira)

unread,
Oct 6, 2022, 5:36:02 PM10/6/22
to puppe...@googlegroups.com
Andy Neff updated an issue
h2. 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.
h2. Where was the bug found?
* System: Developing in a docker
* Version: 4.2.12
* Operating system(s): Linux
* Puppet version: 7.19.0

h2. 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 given the most logical and consistent way, but not how it worked behavior of the other two forms .

{{Facter.value(:kernel)}} is also the correct case: {{Linux}}
h2. What does success look like?

{{​confine :kernel do |value|​}}
{{​  value == "Linux"​}}
{{​end​}}

Should work exactly like the others
h2. How will success be validated?

{{​confine :kernel do |value|​}}
{{​  value == "Linux"​}}
{{​end​}}

Working{{{{}}{}}}
h2. Should anyone be contacted after this is fixed?

Just this ticket
Reply all
Reply to author
Forward
0 new messages