Jira (FACT-2642) fact value for aggregates is printed twice on facter 3 and once on facter 4

17 views
Skip to first unread message

Andrei Filipovici (Jira)

unread,
May 28, 2020, 7:12:04 AM5/28/20
to puppe...@googlegroups.com
Andrei Filipovici created an issue
 
Facter / Bug FACT-2642
fact value for aggregates is printed twice on facter 3 and once on facter 4
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/05/28 4:11 AM
Priority: Normal Normal
Reporter: Andrei Filipovici

For a fact with chunks:

chunk(:chunk1) do

    'value 1'

end

chunk(:chunk2) do

    'value 2'

end

fact.value on facter 3 yields:

value 1

value 2

[

  "value 1",

  "value 2"

]

 

facter 4 gives:

value 1

value 2

 

if we have the aggregate method with just an int, when calling fact.value, facter 3 prints the value twice and facter 4 prints it twice.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Andrei Filipovici (Jira)

unread,
Jul 15, 2020, 5:13:04 AM7/15/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Jul 15, 2020, 9:20:04 AM7/15/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Jul 22, 2020, 9:10:04 AM7/22/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Aug 11, 2020, 8:24:07 AM8/11/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Aug 19, 2020, 9:53:03 AM8/19/20
to puppe...@googlegroups.com

Andrei Filipovici (Jira)

unread,
Aug 20, 2020, 10:17:03 AM8/20/20
to puppe...@googlegroups.com

Andrei Filipovici (Jira)

unread,
Aug 21, 2020, 3:05:03 AM8/21/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
For a fact with chunks:

chunk(:chunk1) do

   
[ 'value 1' ]

end

chunk(:chunk2) do

   
[ 'value 2' ]

end

fact.value on facter 3 yields:

value 1

value 2

[

  "value 1",

  "value 2"

]

 

facter 4 gives:

value 1

value 2

 

if we have the aggregate method with just an int, when calling fact.value, facter 3 prints the value twice and facter 4 prints it twice.

Andrei Filipovici (Jira)

unread,
Aug 21, 2020, 9:43:03 AM8/21/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
For a fact with chunks:

chunk(:chunk1) do

    ['value 1']

end

chunk(:chunk2) do

    ['value 2']

end

and no aggregate function is used.

fact.value on facter 3 yields:

value 1

value 2

[

  "value 1",

  "value 2"

]

 

facter 4 and 2.5.7 gives:

value 1

value 2

 

Also if we have add the aggregate method with just an int, when calling fact.value, facter 3 prints --json or --yaml option the value twice output on facter 2.5.7 and make a fact that aggregates two values:

{
"fact": null
}

On
facter 4 prints it twice is:

1097
. 8
{
"fact": null
}

On facter 3 is:

1071.6171875
{
"agre": 1071.6171875
}

Andrei Filipovici (Jira)

unread,
Aug 21, 2020, 9:46:04 AM8/21/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
For a fact with chunks:

chunk(:chunk1) do

    ['value 1']

end

chunk(:chunk2) do

    ['value 2']

end

and no aggregate function is used.

fact.value on facter 3 yields:

value 1

value 2

[

  "value 1",

  "value 2"

]

 

facter 4 and 2.5.7 gives:

value 1

value 2

 

Also if we add the --json or --yaml option the output on facter 2.5.7 and make a fact that aggregates two values:

{

"fact": null
}

On facter 4 is:

1097.8
{
{ "fact": null
}

On facter 3 is:

1071.6171875
{
{ " agre fact ": 1071.6171875
}

Andrei Filipovici (Jira)

unread,
Aug 21, 2020, 9:54:03 AM8/21/20
to puppe...@googlegroups.com
{ "fact": 1071.6171875 }

The same thing happens if we aggregate two hashes.

Andrei Filipovici (Jira)

unread,
Aug 23, 2020, 5:25:03 PM8/23/20
to puppe...@googlegroups.com
The same thing happens if we aggregate two When the chunks are hashes and we use the --yaml option:

facter 2
. 5:

---
fact:

facter 4:

fact: ""

facter 3:

fact: ""

 

Andrei Filipovici (Jira)

unread,
Aug 23, 2020, 5:57:03 PM8/23/20
to puppe...@googlegroups.com
Andrei Filipovici updated an issue
For 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 chunks :
{code:java}
chunk /fact = Facter::Util::Fact.new ( 'fact')
fact.define_resolution('hgy', type
: chunk1 :aggregate ) do

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

end

chunk(:
chunk2 virtual_memory ) do

    ['value 2']
  end
end

and no aggregate function is used
fact . value/ code placeholder
{code}
fact.value on facter 3 yields:

value 1

value 2

[

  "value 1",

  "value 2"

]

 

facter 4 and 2.5.7 gives: give nil.

value 1

value 2

 

Also if we add the when a fact can't be resolved and -- json or -- yaml option is used the output on facter 2.5.7 and make a fact that aggregates two values outputs are :

{ "fact": null }

On facter
Facter 3 and 4 is :

1097.8

{ "
fact " : null } ""

On facter 3 is Facter 2.5.7 :

1071.6171875 ---

{ "
fact " : 1071.6171875 }

When the
chunks are hashes and we use the -- yaml option json is used :

facter Facter 4 and 2.5 .7 :

--- {
" fact " : null
}
facter 4:

fact: ""

facter
Facter 3:

{
"
fact " : ""

}  

Bogdan Irimie (Jira)

unread,
Aug 26, 2020, 9:04:07 AM8/26/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost-26.08 , ready for triage 2
Reply all
Reply to author
Forward
0 new messages