Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PUP 6.2.0, PUP 6.3.0, PUP 6.4.0
-
Needs Assessment
-
Bug Fix
-
When loading a 3x (legacy) Ruby function containing Ruby syntax errors the error raised would only say "does not seem to be a Puppet 3x API function". Now the underlying syntax error is made visible.
-
Needs Assessment
Description
Puppet Version: 6.4.0
Puppet Server Version: 6.3.0
OS Name/Version: CentOS 7.6.1810
After updating our Puppet Server to latest release we received this issue on agents:
root@xyz1000 # puppet agent --test --environment=production
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, The code loaded from /etc/puppetlabs/code/environments/production/modules/etchosts/lib/puppet/parser/functions/get_host_hash.rb does not seem to be a Puppet 3x API function - no 'newfunction' call. (file: /etc/puppetlabs/code/environments/production/modules/etchosts/manifests/base/solaris.pp, line: 94, column: 15) on node xyz1000.xyz.de
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
The affected function is valid and was accepted valid before (I only replaced "values" by an empty array to reduce complexity:
module Puppet::Parser::Functions
|
newfunction(:get_host_hash, :type => :rvalue, :doc => "") do |args|
|
|
# start with an empty hash
|
temp = Hash.new
|
|
# empty array in this example
|
values = Array.new
|
|
# get the first argument number
|
firstargnr = args[1].to_i
|
|
# get the first argument number
|
secondargnr = args[2].to_i
|
|
# analyze each entry in the values
|
values.each do |entry|
|
|
# split the entry array to sub arrays
|
subentry = entry.split
|
|
# if first requested element starts with # sign or second requested argument starts with + sign skip this entry
|
if not subentry[firstargnr].empty? and not subentry[firstargnr].start_with?("#") and and not subentry[secondargnr].empty? and not subentry[secondargnr].start_with?("+")
|
|
# add to the hash
|
temp.merge!({"#{subentry[firstargnr]}" => "#{subentry[secondargnr]}"})
|
|
end
|
|
end
|
|
# return the hash
|
temp
|
|
end
|
|
end
|
Desired Behavior:
Works fine with 6.0.x and 5.5.x.
Actual Behavior:
Use of "func3x_check = false" in puppet.conf to get te catalog creation running again.
root@xyz1000 # puppet agent --test --environment=production
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xyz1000.xyz.de