Who found the bug? I found the bug Where was the bug found?
- System: Fedora Core
- Version: 36
- Operating system(s): fedora core 36
- Puppet version: not installed
What is malfunctioning? Custom facts in /etc/facter/facts.d that return valid json or yaml are ignored with debug message: ``` DEBUG Facter - Could not parse executable fact output as YAML or JSON (wrong number of arguments (given 2, expected 1)) Use this Test fact in /etc/facter/facts.d/test.py: #! /usr/bin/env python3 print('{"foobar": 23}') /etc/facter/facts.d/test.py | json_verify JSON is valid # facter -d foobar [2022-05-24 12:19:05.899944 ] INFO Facter - executed with command line: -d foobar [2022-05-24 12:19:05.900013 ] DEBUG Facter - Facter version: 4.2.6 [2022-05-24 12:19:05.900106 ] DEBUG Facter::ClassDiscoverer - There is no module named Fedora [2022-05-24 12:19:05.902326 ] DEBUG Facter::FactManager - Resolving facts sequentially [2022-05-24 12:19:05.902462 ] DEBUG Facter::FactLoader - Loading all internal facts [2022-05-24 12:19:05.902564 ] DEBUG Facter::FactLoader - Loading custom facts [2022-05-24 12:19:05.903564 ] DEBUG Facter::FactLoader - Loading external facts [2022-05-24 12:19:05.903836 ] DEBUG Facter::Core::Execution::Posix - Executing command: /etc/facter/facts.d/test.py [2022-05-24 12:19:05.919108 ] DEBUG Facter - Could not parse executable fact output as YAML or JSON (wrong number of arguments (given 2, expected 1)) [2022-05-24 12:19:05.919309 ] DEBUG LegacyFacter::Util::DirectoryLoader - Fact file /etc/facter/facts.d/test.py was parsed but no key=>value data was returned [2022-05-24 12:19:05.993976 ] DEBUG Facter::LegacyFactFormatter - Formatting for single user query [2022-05-24 12:19:05.994074 ] DEBUG Facter::LegacyFactFormatter - Remove quotes from value if it is a simple string What does success look like? facter -d foobar[2022-05-24 12:22:02.893574 ] INFO Facter - executed with command line: -d foobar [2022-05-24 12:22:02.893824 ] DEBUG Facter - Facter version: 4.2.6 [2022-05-24 12:22:02.893891 ] DEBUG Facter::ClassDiscoverer - There is no module named Fedora [2022-05-24 12:22:02.896250 ] DEBUG Facter::FactManager - Resolving facts sequentially [2022-05-24 12:22:02.896355 ] DEBUG Facter::FactLoader - Loading all internal facts [2022-05-24 12:22:02.896464 ] DEBUG Facter::FactLoader - Loading custom facts [2022-05-24 12:22:02.897408 ] DEBUG Facter::FactLoader - Loading external facts [2022-05-24 12:22:02.897680 ] DEBUG Facter::Core::Execution::Posix - Executing command: /etc/facter/facts.d/test.py{}[2022-05-24 12:22:02.987198 ] DEBUG Facter::QueryParser - List of resolvable facts: [#<Facter::SearchedFact:0x00007f40364c3da8 @name="foobar", @fact_class=nil, @user_query="foobar", @type=:external, @file="/etc/facter/facts.d/test.py">] [2022-05-24 12:22:02.987445 ] DEBUG Facter::Util::Fact - external fact foobar got resolved from: /etc/facter/facts.d/test.py [2022-05-24 12:22:02.987544 ] DEBUG Facter::FactManager - fact "foobar" has resolved to: 23 [2022-05-24 12:22:02.987678 ] DEBUG Facter::LegacyFactFormatter - Formatting for single user query [2022-05-24 12:22:02.987766 ] DEBUG Facter::LegacyFactFormatter - Converting hash to pretty json [2022-05-24 12:22:02.987820 ] DEBUG Facter::LegacyFactFormatter - Change key value delimiter from : to => [2022-05-24 12:22:02.987846 ] DEBUG Facter::LegacyFactFormatter - Remove quotes from parent nodes [2022-05-24 12:22:02.987866 ] DEBUG Facter::LegacyFactFormatter - Remove double backslashes from paths [2022-05-24 12:22:02.987881 ] DEBUG Facter::LegacyFactFormatter - Remove quotes from value if it is a simple string 23 Fixed for me: +++ b/usr/share/gems/gems/facter-4.2.6/lib/facter/custom_facts/util/parser.rb @@ -70,7 +70,7 @@ module LegacyFacter def parse_executable_output(output) res = nil begin - res = YAML.safe_load(output, [Symbol, Time]) + res = YAML.safe_load(output, permitted_classes:[Symbol, Time]) rescue StandardError => e Facter.debug("Could not parse executable fact output as YAML or JSON (#{e.message})") end This Jira - userinterface is really a hell. |