Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PUP 5.5.7
-
None
Description
Puppet Version: 5.5.7
Puppet Server Version: 5.3.6
OS Name/Version: Debian 9
After upgrading Puppet from 5.5.6 to 5.5.7, certain custom functions do not work anymore. Specifically, camptocamp/accounts has a function strformat which doesn't work anymore.
The client shows:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, undefined method `strformat' for Scope(Accounts::Authorized_key[stefan-eris-on-root]):Puppet::Parser::Scope (file: /etc/puppetlabs/code/environments/production/modules/accounts/manifests/authorized_key.pp, line: 32, column: 36) (file: /etc/puppetlabs/code/environments/production/modules/accounts/manifests/account.pp, line: 98) |
The server log shows:
ERROR [qtp2035689341-63] [puppetserver] Puppet Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evalu |
ating a Function Call, undefined method `strformat' for Scope(Accounts::Authorized_key[stefan-eris-on-root]):Puppet::Parser::Scope (file: /etc/puppetlabs/code/environmen |
ts/production/modules/accounts/manifests/authorized_key.pp, line: 32, column: 36) (file: /etc/puppetlabs/code/environments/production/modules/accounts/manifests/account. |
pp, line: 98) on node node.example.com |
org/jruby/RubyBasicObject.java:1555:in `method_missing' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/scope.rb:1036:in `method_missing' |
/etc/puppetlabs/code/environments/production/modules/accounts/lib/puppet/parser/functions/strformat.rb:22:in `real_function_strformat' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions.rb:174:in `function_strformat' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions.rb:167:in `function_strformat' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/functions.rb:752:in `call' |
org/jruby/RubyKernel.java:1242:in `catch' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/functions.rb:749:in `call' |
/etc/puppetlabs/code/environments/production/modules/accounts/manifests/authorized_key.pp:32:in `call_function' |
org/jruby/RubyKernel.java:1079:in `eval' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:305:in `call_function' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:303:in `call_function' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:964:in `call_function_with_block' |
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:933:in `eval_CallNamedFunctionExpression' |
|
The code in question reads (abbreviated):
Puppet::Parser::Functions.newfunction(:strformat, :type => :rvalue) do |args| |
def strformat(format, arg)
|
new = format.gsub(/%\{([^%\[\}]+)([^%\}]*)\}/) { eval("arg[$1]#{$2}") } |
(new =~ /%/) ? strformat(new, arg) : new |
end
|
|
strformat(args[0], self.to_hash) |
end
|
|
Attachments
Issue Links
- is caused by
-
PUP-6964 Puppet 4.x functions should be available to all modules not just those that declare the containing module as a dependency
-
- Closed
-
- is duplicated by
-
MODULES-8193 mysql module will break on 5.5.7 and 6.x
-
- Resolved
-
- relates to
-
PUP-9294 Raise Error when a legacy function illegally defines methods
-
- Closed
-