Jira (FACT-2924) Facter fails "closed" if the facter.conf file is invalid

0 views
Skip to first unread message

Tom Parker (Jira)

unread,
Jan 19, 2021, 2:04:03 PM1/19/21
to puppe...@googlegroups.com
Tom Parker created an issue
 
Facter / Bug FACT-2924
Facter fails "closed" if the facter.conf file is invalid
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/01/19 11:03 AM
Priority: Normal Normal
Reporter: Tom Parker

With facter 4 shipped with puppet 7.1 is the facter.conf file is invalid facter fails to load at all which prevents all subsequent puppet runs.  This means that instead of being able to fix the problem with a puppet run the administrator has to login to any affected server and fix the file by hand.  

Would it be possible to fail "open" if the file is invalid?  Log an error and run with all defaults?  This would at least allow puppet to fix the problem on a subsequent run.

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

Tom Parker (Jira)

unread,
Jan 19, 2021, 2:08:03 PM1/19/21
to puppe...@googlegroups.com
Tom Parker updated an issue
Change By: Tom Parker
With facter 4 shipped with puppet 7.1 is if the facter.conf file is invalid facter fails to load at all which prevents all subsequent puppet runs. 

 

This means that instead of being able to fix the problem with a puppet run the administrator has to login to any affected server and fix the file by hand.  

Would it be possible to fail "open" if the file is invalid?  Log an error and run with all defaults?  This would at least allow puppet to fix the problem on a subsequent run.

Mihai Buzgau (Jira)

unread,
Jan 20, 2021, 5:00:02 AM1/20/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Jan 20, 2021, 5:01:02 AM1/20/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Jan 20, 2021, 5:01:03 AM1/20/21
to puppe...@googlegroups.com

Oana Tanasoiu (Jira)

unread,
Jan 20, 2021, 7:48:04 AM1/20/21
to puppe...@googlegroups.com

Oana Tanasoiu (Jira)

unread,
Jan 27, 2021, 3:47:03 AM1/27/21
to puppe...@googlegroups.com
Oana Tanasoiu updated an issue
Change By: Oana Tanasoiu
Release Notes: Bug Fix
Release Notes Summary: Description of the problem: Facter fails when an invalid config file is provided.

Description of the fix: Log a warning message stating that the parsing of config file failed and continue retrieving facts with the default options.

Ciprian Badescu (Jira)

unread,
Feb 4, 2021, 5:39:03 AM2/4/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Feb 5, 2021, 4:23:03 AM2/5/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Feb 5, 2021, 4:30:03 AM2/5/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
Change By: Claire Cadman
Labels: doc_reviewed docs-reviewed

Claire Cadman (Jira)

unread,
Feb 5, 2021, 4:30:03 AM2/5/21
to puppe...@googlegroups.com

Tom Parker (Jira)

unread,
Mar 9, 2021, 12:32:02 PM3/9/21
to puppe...@googlegroups.com
Tom Parker commented on Bug FACT-2924
 
Re: Facter fails "closed" if the facter.conf file is invalid

This is still not 100% fixed.  On puppet-agent.x86_64 0:7.4.1-1.el7 I can't even run a puppet agent --version without a crash.

My badly formatted facter.conf (caused by erroneously converting to json unstead of hocon) is:

{{{ }}
{{  "facts": { }}
{{    "blocklist": null, }}
{{    "ttls": [ }}
{{      { }}
{{        "EC2": "1 day" }}
{{      } }}
{{    ] }}
{{  } }}
}

[LIVE] gredb1 [k: gredb]:~ # puppet agent --version
Traceback (most recent call last):
       21: from /opt/puppetlabs/puppet/bin/puppet:4:in `<main>'
       20: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       19: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       18: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:12:in `<top (required)>'
       17: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       16: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       15: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:15:in `<top (required)>'
       14: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       13: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
       12: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:10:in `<top (required)>'
       11: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:13:in `<module:Facter>'
       10: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/options.rb:40:in `init'
        9: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/options/config_file_options.rb:12:in `init'
        8: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/options/config_file_options.rb:24:in `augment_all'
        7: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/options/config_file_options.rb:93:in `augment_facts'
        6: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/options/config_file_options.rb:93:in `new'
        5: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:16:in `initialize'
        4: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:83:in `load_facts_ttls'
        3: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:83:in `each'
        2: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:84:in `block in load_facts_ttls'
        1: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:106:in `ttls_to_seconds'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/config/fact_groups.rb:106:in `*': nil can't be coerced into Integer (TypeError)

Tom Parker (Jira)

unread,
Mar 9, 2021, 12:34:03 PM3/9/21
to puppe...@googlegroups.com
Tom Parker updated an issue
 
Change By: Tom Parker
Attachment: facter.conf

Oana Tanasoiu (Jira)

unread,
Mar 10, 2021, 3:38:02 AM3/10/21
to puppe...@googlegroups.com
Oana Tanasoiu commented on Bug FACT-2924
 
Re: Facter fails "closed" if the facter.conf file is invalid

Hi Tom Parker ,

 

Good catch! The failure you're seeing is because we didn't accept forms like 'day', only 'days' and it's not because of the JSON form (which is hocon validated). A pull request was opened to fix this issue.

 

Thank you for reporting this!

Mihai Buzgau (Jira)

unread,
Mar 10, 2021, 4:08:03 AM3/10/21
to puppe...@googlegroups.com
Mihai Buzgau commented on Bug FACT-2924

These changes were already released, we need a new ticket for this.

Oana Tanasoiu (Jira)

unread,
Mar 10, 2021, 4:49:03 AM3/10/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages