Jira (FACT-1528) Custom Ruby facts with additional resolutions instead replace core facts

3 views
Skip to first unread message

Michael Smith (JIRA)

unread,
Oct 28, 2016, 1:22:17 PM10/28/16
to puppe...@googlegroups.com
Michael Smith updated an issue
 
Facter / Bug FACT-1528
Custom Ruby facts with additional resolutions instead replace core facts
Change By: Michael Smith
Summary: Custom Ruby facts  with additional resolutions instead  replace core facts
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Michael Smith (JIRA)

unread,
Oct 28, 2016, 2:00:10 PM10/28/16
to puppe...@googlegroups.com

Michael Smith (JIRA)

unread,
Oct 28, 2016, 2:01:14 PM10/28/16
to puppe...@googlegroups.com

Michael Smith (JIRA)

unread,
Feb 7, 2017, 2:28:03 PM2/7/17
to puppe...@googlegroups.com

Branan Riley (JIRA)

unread,
Mar 15, 2017, 5:37:02 PM3/15/17
to puppe...@googlegroups.com
Branan Riley commented on Bug FACT-1528
 
Re: Custom Ruby facts with additional resolutions instead replace core facts

I think the general behavior of how custom implementation can override core facts is expected in facter 3, and is a result of the way Facter now works under the hood.

Facter 3 resolvers are not tied to a given fact, like they are in Ruby facter - they collect many related facts, and populate them all at once. This is part of how we get such a huge performance improvement - we're not calling the same commands over and over for similar facts.

Facter 2 and Ruby fact compatibility is implemented in this same way - all Ruby facts are essentially one Facter 3 "resolver". This means that they have no knowledge of core fact implementations, and, since they are run last, will happily overwrite them.

An abridged pseudocode view of what Facter 3 is doing here:

  • gather_all_filesystem_facts # Collect and set all the filesystem/disk facts with as few commands as possible
  • gather_all_network_facts # Ditto for all the networking-related things
  • gather_all_os_version_facts # Once more for all the OS-related things
  • gather_all_ruby_custom_facts # your ruby OS fact overwrites a core fact value here!

One of the things we've considered is trying to better expose this model in Facter's APIs, and make it clearer that custom facts are really running in a "virtual facter 2" within Facter 3's new model.

All of that being said: It does appear that your confine isn't being respected, which I think is a bug

Branan Riley (JIRA)

unread,
May 30, 2017, 10:37:03 AM5/30/17
to puppe...@googlegroups.com

Matthew Patton (JIRA)

unread,
Mar 5, 2018, 11:12:04 PM3/5/18
to puppe...@googlegroups.com
Matthew Patton commented on Bug FACT-1528
 
Re: Custom Ruby facts with additional resolutions instead replace core facts

was there a regression since 3.4.x? I'm using 3.6.6 (commit d0295a91b6) and try as I might can't override build-in facts via custom.

I can override via commandline:

FACTER_os="some string" facter os 

but any value of 'has_weight' (or omitted) yields no updates

separator = { 'file' => File::SEPARATOR, 'path' => File::PATH_SEPARATOR }
 
combined = Facter.value(:os).merge({ 'separator' => separator })
Facter.add(:os) do
  has_weight(99)
  setcode do
    combined
  end
end

I'm expecting to see but alas the 'separator' block never comes thru.

  os:
    architecture: x86_64
    family: RedHat
...
    separator:
      file: "/"
      path: ":" 

What is curious is I can override other facts like 'operatingsystem' and 'root_dir' with my $combined just fine. Is there some magic protection around 'os' that prevents overwriting?

 

This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Branan Riley (JIRA)

unread,
Mar 21, 2018, 6:44:02 PM3/21/18
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 26, 2023, 4:57:03 PM4/26/23
to puppe...@googlegroups.com
Josh Cooper commented on Bug FACT-1528
 
Re: Custom Ruby facts with additional resolutions instead replace core facts

Currently facter doesn't merge fact values from multiple resolutions, so you can't augment an existing "os" fact with additional data. Since Facter 3 is EOL and there is already a ticket for Facter 4 that describes this in more detail, I'm going to close this as a dup.

This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages