40 cards
View
Posted about 1 month ago. Visible to the public.

Debug Puppet "Error: Failed to apply catalog: undefined method [...] for nil:NilClass"

If you get e.g. this error message when you try to run puppet agent:

Copy
Error: Failed to apply catalog: undefined method `strip' for nil:NilClass

you could have a very bad time debugging it. Because there will be no messages in the logs which could help you.

You should always remember puppet agents --trace option, because that's probably the only way how you can track this error. For example if you have an unparsable mail aliases file you will get this:

Copy
# puppet agent --test --trace --noop Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Info: Applying configuration version '1558534846' Error: Failed to apply catalog: undefined method `strip' for nil:NilClass /usr/local/lib/ruby/site_ruby/2.4/puppet/provider/mailalias/aliases.rb:28:in `process' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb:152:in `handle_record_line' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb:244:in `block in parse_line' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb:240:in `each' /usr/local/lib/ruby/site_ruby/2.4/puppet/util/fileparsing.rb:240:in `parse_line' [...]

Owner of this card:

Avatar
Kim Jahn
Last edit:
about 1 month ago
by Kim Jahn
This website uses cookies to improve usability and analyze traffic.
Accept or learn more