% sudo find . -type f |xargs fgrep -l .find
./modules/stdlib/lib/puppet/provider/file_line/ruby.rb
./modules/stdlib/lib/puppet/parser/functions/get_module_path.rb
./modules/stdlib/spec/unit/puppet/type/file_line_spec.rb
The call to `find` is in Ruby, not in puppet. There are numerous calls
to find in the Ruby code base.
To find where the error is run the compilation with --trace and look at
the logged exception - it will tell you where in Ruby the error
occurred. From there is should be able to trace backwards.
If you are on the latest 4.x the backtrace will include puppet function
calls as well as Ruby methods to make this easier.
The error:
Error: Failed to apply catalog: undefined method `find' for nil:NilClass
may come from an `undef` value (translated to Ruby nil in Ruby if you
are using future parser or 4.x)
Hope this helps pin down where the problem is.
% sudo puppet agent -t --trace
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppet.localdomain
Info: Applying configuration version '1473304882'
Error: Failed to apply catalog: undefined method `find' for nil:NilClass
/usr/local/lib/ruby/site_ruby/2.2/puppet/provider/package/pkgng.rb:66:in `block in prefetch'
/usr/local/lib/ruby/site_ruby/2.2/puppet/provider/package/pkgng.rb:65:in `each'
/usr/local/lib/ruby/site_ruby/2.2/puppet/provider/package/pkgng.rb:65:in `prefetch'
/usr/local/lib/ruby/site_ruby/2.2/puppet/transaction.rb:305:in `prefetch'
/usr/local/lib/ruby/site_ruby/2.2/puppet/transaction.rb:205:in `prefetch_if_necessary'
/usr/local/lib/ruby/site_ruby/2.2/puppet/transaction.rb:97:in `block in evaluate'
/usr/local/lib/ruby/site_ruby/2.2/puppet/graph/relationship_graph.rb:116:in `call'
/usr/local/lib/ruby/site_ruby/2.2/puppet/graph/relationship_graph.rb:116:in `traverse'
/usr/local/lib/ruby/site_ruby/2.2/puppet/transaction.rb:142:in `evaluate'
/usr/local/lib/ruby/site_ruby/2.2/puppet/resource/catalog.rb:222:in `block in apply'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util/log.rb:155:in `with_destination'
/usr/local/lib/ruby/site_ruby/2.2/puppet/transaction/report.rb:118:in `as_logging_destination'
/usr/local/lib/ruby/site_ruby/2.2/puppet/resource/catalog.rb:221:in `apply'
/usr/local/lib/ruby/site_ruby/2.2/puppet/configurer.rb:171:in `block in apply_catalog'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util.rb:223:in `block in benchmark'
/usr/local/lib/ruby/2.2/benchmark.rb:303:in `realtime'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util.rb:222:in `benchmark'
/usr/local/lib/ruby/site_ruby/2.2/puppet/configurer.rb:170:in `apply_catalog'
/usr/local/lib/ruby/site_ruby/2.2/puppet/configurer.rb:315:in `run_internal'
/usr/local/lib/ruby/site_ruby/2.2/puppet/configurer.rb:186:in `block in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/context.rb:65:in `override'
/usr/local/lib/ruby/site_ruby/2.2/puppet.rb:240:in `override'
/usr/local/lib/ruby/site_ruby/2.2/puppet/configurer.rb:185:in `run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:45:in `block (4 levels) in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent/locker.rb:21:in `lock'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:45:in `block (3 levels) in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:98:in `with_client'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:42:in `block (2 levels) in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:65:in `run_in_fork'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:41:in `block in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application.rb:179:in `call'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application.rb:179:in `controlled_run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/agent.rb:39:in `run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application/agent.rb:353:in `onetime'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application/agent.rb:331:in `run_command'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application.rb:344:in `block in run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util.rb:540:in `exit_on_fail'
/usr/local/lib/ruby/site_ruby/2.2/puppet/application.rb:344:in `run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util/command_line.rb:128:in `run'
/usr/local/lib/ruby/site_ruby/2.2/puppet/util/command_line.rb:72:in `execute'
/usr/local/bin/puppet:5:in `<main>'