Jira (FACT-3112) Stack trace on invalid facts.d entry

26 views
Skip to first unread message

Steve Traylen (Jira)

unread,
Mar 31, 2022, 3:51:03 AM3/31/22
to puppe...@googlegroups.com
Steve Traylen created an issue
 
Facter / Improvement FACT-3112
Stack trace on invalid facts.d entry
Issue Type: Improvement Improvement
Affects Versions: FACT 4.2.5
Assignee: Unassigned
Components: Facter 4
Created: 2022/03/31 12:50 AM
Environment:

CentOS 7 
puppet-agent-7.12.0.7.g9fc268bde-4.config8s.x86_64

Priority: Normal Normal
Reporter: Steve Traylen

We had a bad fact.s fact:

/etc/facter/facts.d/queue.py
{ "": }

That is invalid json:

# /etc/facter/facts.d/yarn_queue.py | jq .
parse error: Unmatched '}' at line 1, column 7

This results in a non-obvious stack trace.
Would be good if this caught as a warning or something.

Traceback (most recent call last):
        23: from /opt/puppetlabs/puppet/bin/facter:10:in `<main>'
        22: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli_launcher.rb:23:in `start'                                
        21: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'                                    
        20: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'                                      
        19: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'                     
        18: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'                                    
        17: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli.rb:124:in `query'                                        
        16: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:454:in `to_user_output'                                                 
        15: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:521:in `resolve_facts_for_user_query'                                   
        14: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:24:in `resolve_facts'                       
        13: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:7:in `resolve_facts' 
        12: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:19:in `external_facts'
        11: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:19:in `each'         
        10: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/external/external_fact_manager.rb:21:in `block in external_facts'
         9: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:127:in `value'                                   
         8: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:177:in `searching'                               
         7: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:137:in `block in value'                          
         6: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb:159:in `resolve_value'                           
         5: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:135:in `core_value'                                                     
         4: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/models/fact_collection.rb:21:in `build_fact_collection!'                   
         3: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/models/fact_collection.rb:21:in `each'                                     
         2: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/models/fact_collection.rb:24:in `block in build_fact_collection!'          
         1: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/models/fact_collection.rb:80:in `bury_fact'                                
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/models/fact_collection.rb:57:in `bury': 2 or more arguments required (ArgumentError)   

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Nirupama Mantha (Jira)

unread,
Apr 5, 2022, 4:30:05 PM4/5/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Acceptance Criteria: The behavior should be the same as in Facter 3. We just want to surface a warning or error in line with how it's handles in Facter 3.
Story Points: 3

Josh Cooper (Jira)

unread,
Apr 20, 2022, 11:18:02 AM4/20/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Phoenix 2022-05-11

Josh Cooper (Jira)

unread,
Apr 20, 2022, 11:18:02 AM4/20/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Phoenix

Josh Cooper (Jira)

unread,
Apr 21, 2022, 2:04:07 PM4/21/22
to puppe...@googlegroups.com
Josh Cooper commented on Improvement FACT-3112
 
Re: Stack trace on invalid facts.d entry

Facter 3 detected if it failed to parse JSON and raised an exception with information about the parse error. Facter 4 should do the same. It seems it's swallowing the JSON parse error and then later tries to add a fact name, but the value is missing.

Also check if Facter 4 has the same issue with YAML external facts

Josh Cooper (Jira)

unread,
Apr 21, 2022, 3:44:02 PM4/21/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Phoenix 2022-05- 11 25

Tony Vu (Jira)

unread,
May 11, 2022, 11:56:02 AM5/11/22
to puppe...@googlegroups.com
Tony Vu updated an issue
Change By: Tony Vu
Sprint: Phoenix 2022- 05 06 - 25 08

Nirupama Mantha (Jira)

unread,
Jun 8, 2022, 11:13:02 AM6/8/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022-06-08 , Phoenix 2022-06-22

Nirupama Mantha (Jira)

unread,
Jun 8, 2022, 12:08:02 PM6/8/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022-06-08, Phoenix 2022- 06 07 - 22 06

Nirupama Mantha (Jira)

unread,
Jun 22, 2022, 11:50:02 AM6/22/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022-06-08, Phoenix 2022-07- 06 20

Nirupama Mantha (Jira)

unread,
Jul 6, 2022, 12:34:03 PM7/6/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022-06-08, Phoenix 2022- 07 08 - 20 03

Nirupama Mantha (Jira)

unread,
Jul 20, 2022, 12:24:03 PM7/20/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022-06-08, Phoenix 2022-08- 03 17
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Lisa Ross (Jira)

unread,
Aug 3, 2022, 8:41:02 AM8/3/22
to puppe...@googlegroups.com
Lisa Ross updated an issue
Change By: Lisa Ross
Epic Link: FACT-3139

Josh Cooper (Jira)

unread,
Aug 8, 2022, 8:45:01 PM8/8/22
to puppe...@googlegroups.com
Josh Cooper commented on Improvement FACT-3112
 
Re: Stack trace on invalid facts.d entry

Steve Traylen Facter 4 behavior seems reasonable to me as it prints a warning with the path to the external fact:

$ cat ~/.facter/facts.d/queue.py 
{ "": }
$ bundle exec puppet apply -e ''                                     
Warning: Facter: Command /home/josh/.facter/facts.d/queue.py completed with the following stderr message: /home/josh/.facter/facts.d/queue.py: 2: Syntax error: end of file unexpected (expecting "}")
Notice: Compiled catalog for localhost in environment production in 0.01 seconds
Notice: Applied catalog in 0.01 seconds

Also puppet-agent-7.12.0.7.g9fc268bde-4.config8s.x86_64 is not a valid puppet-agent version (specifically 9fc268bde):

$ git show 9fc268bde
fatal: ambiguous argument '9fc268bde': unknown revision or path not in the working tree.

Perhaps you have a locally applied patch that's causing issues?

Christopher Thorn (Jira)

unread,
Aug 17, 2022, 12:13:02 PM8/17/22
to puppe...@googlegroups.com
Christopher Thorn updated an issue
 
Change By: Christopher Thorn
Sprint: Phoenix 2022-06-08, Phoenix 2022-08-17 , Phoenix 2022-08-31

Morgan Rhodes (Jira)

unread,
Aug 17, 2022, 12:46:02 PM8/17/22
to puppe...@googlegroups.com
Morgan Rhodes updated an issue
Change By: Morgan Rhodes
Sprint: Phoenix 2022-06-08, Phoenix 2022-08-17, Phoenix 2022- 08 09 - 31 14

Josh Cooper (Jira)

unread,
Aug 24, 2022, 1:02:01 PM8/24/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Epic Link: FACT-3139

Josh Cooper (Jira)

unread,
Aug 24, 2022, 1:03:03 PM8/24/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Phoenix 2022-06-08, Phoenix 2022-08-17 , Phoenix 2022-09-14

Josh Cooper (Jira)

unread,
Jan 9, 2023, 3:05:01 PM1/9/23
to puppe...@googlegroups.com
Josh Cooper commented on Improvement FACT-3112
 
Re: Stack trace on invalid facts.d entry

Since we haven't heard back, I'm going to close this. Feel free to reopen if you have steps to reproduce using a puppet-agent package built by Puppet.

Reply all
Reply to author
Forward
0 new messages