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

4 views
Skip to first unread message

Andy Neff (Jira)

unread,
Oct 6, 2022, 5:26:03 PM10/6/22
to puppe...@googlegroups.com
Andy Neff created an issue
 
Facter / Bug FACT-3156
confine iterable is incorrectly lowercases the value
Issue Type: Bug Bug
Affects Versions: FACT 4.2.11, FACT 4.2.12
Assignee: Unassigned
Components: Facter 4
Created: 2022/10/06 2:25 PM
Environment:

docker run -it --rm --entrypoint= puppet/puppet-agent bash

puppet agent -t

Priority: Normal Normal
Reporter: Andy Neff

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:

  1. confine :kernel => "Linux"
    As I understand this it calls {{confine }}with a hashmap as an argument. So I assume confine matches based on that.
  1. 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.
  2. 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

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:27:02 PM10/6/22
to puppe...@googlegroups.com
Andy Neff updated an issue
Change By: Andy Neff
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 the most logical and consistent way, but not how it worked.


{{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