Page MenuHomePhabricator

Puppet: Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `known_resource_types'
Closed, ResolvedPublic

Description

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!

Event Timeline

herron updated the task description. (Show Details)

I feared this would happen.

require_package (and role as well) do deep in the bowels of puppet and will probably need a makeover for puppet 4, as they go way deeper than the parser.

Sadly, require_package is omnipresent in our code and so it's mandatory we fix it.

Joe raised the priority of this task from Medium to High.

Change 386614 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] require_package: puppet 4.x compatibility

https://gerrit.wikimedia.org/r/386614

Change 386614 merged by Giuseppe Lavagetto:
[operations/puppet@production] require_package: puppet 4.x compatibility

https://gerrit.wikimedia.org/r/386614

herron removed a project: Patch-For-Review.