Jira (FACT-2965) Facter 4 outputs the processors.speed fact differently on AIX

16 views
Skip to first unread message

Luchian Nemes (Jira)

unread,
Mar 12, 2021, 9:30:03 AM3/12/21
to puppe...@googlegroups.com
Luchian Nemes created an issue
 
Facter / Bug FACT-2965
Facter 4 outputs the processors.speed fact differently on AIX
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/03/12 6:29 AM
Priority: Normal Normal
Reporter: Luchian Nemes

Running puppet facts diff on AIX 7.1 and AIX 7.2 gives the following output:

{
  {
  "processors.speed": {
    "new_value": "3.42 GHz",
    "old_value": "3.43 GHz"
  }
}

Note: EXCLUDE_LIST from https://github.com/puppetlabs/puppet/blob/6.x/lib/puppet/face/facts.rb#L5 needs to be manually emptied to see above results.
More info: https://docs.google.com/document/d/1QlX_mv17fZ4eVZa9zHxvTRVJ5sq88aj3GjUC6lVFiz0/edit#heading=h.gnnvlmulav1v

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

Florin Dragos (Jira)

unread,
Mar 16, 2021, 10:50:03 AM3/16/21
to puppe...@googlegroups.com
Florin Dragos commented on Bug FACT-2965
 
Re: Facter 4 outputs the processors.speed fact differently on AIX

The difference here is a result of c++ rounding up, and ruby rounding the number down. The read value is 3425000000 (Hz) when converted to Ghz results in 3.425. When this gets rounded to 2 decimals, it ends up as 3.42 in ruby and 3.43 in c++. This only happens when the Ghz value has more than 2 decimals and ends with 5. As a fix we can round the number before formatting: https://github.com/puppetlabs/facter/blob/b9f6c32acb7433f05fe6227cc25d9d1c359b2f5b/lib/facter/util/facts/unit_converter.rb#L22 like 

format('%<displayed_speed>.2f', displayed_speed: validated_speed.round(2)).to_s

Mihai Buzgau (Jira)

unread,
Mar 17, 2021, 6:44:03 AM3/17/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 17, 2021, 6:44:04 AM3/17/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 17, 2021, 6:44:04 AM3/17/21
to puppe...@googlegroups.com

Victor Bobosila (Jira)

unread,
Mar 24, 2021, 11:22:03 AM3/24/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Mar 30, 2021, 11:46:02 AM3/30/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Apr 13, 2021, 9:30:01 AM4/13/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
Change By: Claire Cadman
Labels: doc_reviewed
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages