Jira (FACT-2772) Facter 4 fails to guard against recursion (FACT-1373)

1 megtekintés
Ugrás az első olvasatlan üzenetre

Josh Cooper (Jira)

olvasatlan,
2023. jan. 9. 14:10:012023. 01. 09.
– puppe...@googlegroups.com
Josh Cooper updated an issue
 
Facter / Bug FACT-2772
Facter 4 fails to guard against recursion (FACT-1373)
Change By: Josh Cooper
Team: Night's Watch Phoenix
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

olvasatlan,
2023. jan. 9. 14:10:022023. 01. 09.
– puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Summary: Facter in puppet 6.18.0-1 4 fails to prevent external facts from calling facter recursively guard against recursion (FACT-1373)

Josh Cooper (Jira)

olvasatlan,
2023. jan. 9. 15:01:022023. 01. 09.
– puppe...@googlegroups.com

Josh Cooper (Jira)

olvasatlan,
2023. ápr. 6. 13:51:012023. 04. 06.
– puppe...@googlegroups.com
Josh Cooper updated an issue
After updating puppet to verision 6.18.0-1, the following script, located in `/opt/puppetlabs/facter/facts.d/` recurses into oblivion

 
{noformat}#!/usr/bin/env ruby
require 'json'
osfamily = %x(/opt/puppetlabs/bin/facter --no-custom-facts --no-external-facts os.family).strip
@data = {
  packages: {}
}
def parse_redhat
  packagelist = %x(rpm -qa --qf '%{NAME};%{VERSION}-%{RELEASE}\n').split("\n")
  packagelist.each do |package|
    pname   = package.split(';').first
    version = package.split(';').last
    @data[:packages][pname] = version.strip
  end
end
def parse_debian
  packagelist = %x(dpkg-query -W -f='${binary:Package};${Version}\n').split("\n")
  packagelist.each do |package|
    pname   = package.split(';').first
    version = package.split(';').last
    @data[:packages][pname] = version.strip
  end
end
if osfamily == 'RedHat'
  parse_redhat
end
if osfamily == 'Debian'
  parse_debian
end
puts @data.to_json
{noformat}
 

I created this ticket after I talked to the slack community puppet guy Josh ([https://puppetcommunity.slack.com/archives/C0W298S9G/p1598386635326500)]
{quote}"@kervyn facter 3.x (which is the default in puppet 6) has logic to prevent external facts from calling facter recursively (FACT-1373) but it seems that's not working as expected. Can you file a FACT ticket and link the 1373?"
{quote}


For this ticket, Facter 4 should check if the INSIDE_FACTER environment variable is set prior to evaluating external facts. If it's not set, then set the variable. See how this is implemented in facter 3 https://github.com/puppetlabs/facter/blob/6d7ffc6efdfbc3b1fc79311cdeb4581ac2098d9c/exe/facter.cc#L282-L293 If recursion is detected, facter would emit an error similar to "Facter was called recursively, skipping external facts. Add '--no-external-facts' to silence this warning" and it should automatically ignore external facts.

Josh Cooper (Jira)

olvasatlan,
2023. ápr. 6. 13:57:012023. 04. 06.
– puppe...@googlegroups.com
If it's not set, then set the variable . See , see how this is implemented in facter 3 https://github.com/puppetlabs/facter/blob/6d7ffc6efdfbc3b1fc79311cdeb4581ac2098d9c/exe/facter.cc#L282-L293
If recursion is detected, facter would should emit an error similar to "Facter was called recursively, skipping external facts. Add '--no-external-facts' to silence this warning" and it should automatically ignore external facts.

You may want to implement this in {{lib/facter/framework/cli/cli.rb}}

Josh Cooper (Jira)

olvasatlan,
2023. ápr. 6. 13:58:022023. 04. 06.
– puppe...@googlegroups.com
If it's not set, then set the variable, see how this is implemented in facter 3 https://github.com/puppetlabs/facter/blob/6d7ffc6efdfbc3b1fc79311cdeb4581ac2098d9c/exe/facter.cc#L282-L293
If recursion is detected, facter should emit an error similar to "Facter was called recursively, skipping external facts. Add '--no-external-facts' to silence this warning" and it should automatically ignore external facts. You may want to implement this in {{lib/facter/framework/cli/cli.rb}}

Need to account for different ways facter can be called (via command line, puppet, to_hash, resolve(''), resolve('os.family')). Create additional tickets as needed.

Josh Cooper (Jira)

olvasatlan,
2023. ápr. 6. 13:59:022023. 04. 06.
– puppe...@googlegroups.com

Tony Vu (Jira)

olvasatlan,
2023. ápr. 26. 13:44:012023. 04. 26.
– puppe...@googlegroups.com
Tony Vu updated an issue
Change By: Tony Vu
Sprint: Phoenix 2023-05-10

Tony Vu (Jira)

olvasatlan,
2023. ápr. 26. 13:53:032023. 04. 26.
– puppe...@googlegroups.com
Tony Vu assigned an issue to Tony Vu
Change By: Tony Vu
Assignee: Tony Vu

Tony Vu (Jira)

olvasatlan,
2023. máj. 10. 13:10:022023. 05. 10.
– puppe...@googlegroups.com
Tony Vu updated an issue
Change By: Tony Vu
Sprint: Phoenix 2023-05-10 , Phoenix 2023-05-24

Christopher Thorn (Jira)

olvasatlan,
2023. jún. 8. 18:46:022023. 06. 08.
– puppe...@googlegroups.com
Christopher Thorn updated an issue
Change By: Christopher Thorn
Fix Version/s: FACT 4.4.1
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo

Tony Vu (Jira)

olvasatlan,
2023. jún. 8. 19:14:022023. 06. 08.
– puppe...@googlegroups.com
Tony Vu updated an issue
Change By: Tony Vu
Release Notes: Bug Fix
Release Notes Summary: Facter 3 guarded against recursive calls to facter inside external facts; this has now been added to Facter 4. If an external fact calls out to facter without specifying the no-external-facts, facter will warn the user and skip falling into calling facter recursively.

Parker Leach (Jira)

olvasatlan,
2023. jún. 14. 13:18:012023. 06. 14.
– puppe...@googlegroups.com
Parker Leach updated an issue
Change By: Parker Leach
Labels: docs_reviewed regression
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet