There are a few variations of Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types' occurring when compiling catalogs with puppetmaster2001 running puppet 4.8.2.
Here are a couple examples from hosts chosen at random:
Failed to retrieve catalog from https://puppetmaster2001.codfw.wmnet:8140/future/catalog/aqs1006.eqiad.wmnet: 500 {"message":"Server Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types' for Scope(Class[Prometheus::Node_puppet_agent]):Puppet::Parser::Scope at /etc/puppet/modules/prometheus/manifests/node_puppet_agent.pp:13:5 on node aqs1006.eqiad.wmnet
Failed to retrieve catalog from https://puppetmaster2001.codfw.wmnet:8140/future/catalog/analytics1051.eqiad.wmnet: 500 {"message":"Server Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types' for Scope(Class[Profile::Java::Analytics]):Puppet::Parser::Scope at /etc/puppet/modules/profile/manifests/java/analytics.pp:13:9 on node analytics1051.eqiad.wmnet
In both cases the offending line is a call to require_package()
Some additional information from puppetmaster2001:
Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types' for Scope(Class[Prometheus::Node_puppet_agent]):Puppet::Parser::Scope at /etc/puppet/modules/prometheus/manifests/node_puppet_agent.pp:13:5 on node aqs1006.eqiad.wmnet Server Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types' for Scope(Class[Prometheus::Node_puppet_agent]):Puppet::Parser::Scope at /etc/puppet/modules/prometheus/manifests/node_puppet_agent.pp:13:5 on node aqs1006.eqiad.wmnet /usr/lib/ruby/vendor_ruby/puppet/parser/scope.rb:997:in `method_missing' /etc/puppet/modules/wmflib/lib/puppet/parser/functions/require_package.rb:33:in `block (2 levels) in <module:Functions>' /etc/puppet/modules/wmflib/lib/puppet/parser/functions/require_package.rb:23:in `each' /etc/puppet/modules/wmflib/lib/puppet/parser/functions/require_package.rb:23:in `block in <module:Functions>' /usr/lib/ruby/vendor_ruby/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction' /usr/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile' /usr/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile' /usr/lib/ruby/vendor_ruby/puppet/parser/functions.rb:167:in `block in newfunction' /etc/puppet/modules/prometheus/manifests/node_puppet_agent.pp:13:in `stack'
Coincidentally both occur on line number 13. Spooky!