Jira (FACT-2642) custom fact containing fact.value shows value on facter 3 but not on facter 4

4 views
Skip to first unread message

Andrei Filipovici (Jira)

unread,
Sep 1, 2020, 8:53:03 AM9/1/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
 
Facter / Bug FACT-2642
custom fact containing fact.value shows value on facter 3 but not on facter 4
Change By: Andrei Filipovici
Summary: custom fact containing fact. value for aggregates is printed twice shows value on facter 3 and once but not on facter 4
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Andrei Filipovici (Jira)

unread,
Sep 1, 2020, 9:23:03 AM9/1/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
When using the last example with the memory addition from here:

[https://puppet.com/docs/facter/3.11/fact_overview.html#writing-facts-with-aggregate-resolutions]

and print the fact without any option and with --yaml and --json the only difference between facter 3 and 4 is how float numbers are printed with the yaml option:

On facter 3:

fact: 1135.015625

Facter 4:

fact: "1102.89"

The rest is the same. Facter 2 can't even solve the fact.

 

When printing hash values, everything works the same and no aggregate function is used.

 

When printing arrays there's a spacing difference when using the --yaml option:

Facter 3:

fact:
    - value 1
    - value
2

Facter 4:

fact:
- value 1
- value 2

 

Facter 2
.5.7 and facter 4 are unable to solve aggregate custom facts, if they are written with like this :
{code:java}

/
fact = Facter::Util::Fact.new('fact')
fact.define_resolution('hgy', type: :aggregate) do

  chunk(:physical_memory) do
    ['value 1']
  end

  chunk(:virtual_memory) do

    ['value 2']
  end
  end
fact.value/ code placeholder
{code}
fact.value on facter 3 yields:

[

  "value 1",

  "value 2"

]

facter 4 and 2.5.7
give return nil.

Also when a If fact can't be resolved and --yaml .value is used missing from the outputs are:

Facter
custom fact file, facter 3 and 4: won't show any result.

fact: ""  

Facter
2 4 returns nil even if fact . 5 value is missing . 7:

---
This happens because, by using this construction, the fact : is not added to the facts collection and it can't be found.

When This behaviour is not documented and the --json normal way of creating facts is used:

with Facter 4 and 2 . 5 add . 7:

{
"fact": null
}

Facter 3:

{
"fact": ""
Reply all
Reply to author
Forward
0 new messages