Hello
We are in progress of moving from Puppet 4 to 5/6 and we currently have
a lab installation of both versions to toy around with.
Our agents are still on version 4 and for them everything works as
expected without any issues no matter if they connect to the version 4,
5 or 6 puppetserver.
However if we use a version 5 or 6 agent to connect to those version 5
or 6 servers we get a really strange error:
Error: /File[/opt/puppetlabs/puppet/cache/lib]: Failed to generate
additional resources using 'eval_generate': Could not intern_multiple
from application/json: Invalid parameter ftype to object class
Puppet::FileServing::Metadata
We found out that if we force the client to use PSON with
"--preferred_serialization_format pson" the problem goes away. This is
also why the problem only occurs on agents > 5 as they are now using
json as default.
This also only affects the plugin endpoints where it syncs facts.d, lib
and locals at the very start of the run. The catalog itself can be
retrieved without issue with json.
So I tried to track this down a bit further. The issue seems to
originate from a part of code where Puppet tries to add values from a
received json hash to an object:
https://github.com/puppetlabs/puppet/blob/41760e1646ffd91942ebc2290b5108ce31fe529d/lib/puppet/util/methodhelper.rb#L16
The data I get with PSON here is:
[{
"path":"/etc/puppetlabs/code/environments/test/modules",
"relative_path":".",
"links":"follow",
"owner":0,
"group":10080,
"mode":1517,
"checksum":{
"type":"ctime",
"value":"{ctime}2019-02-11 11:02:06 +0100"
},
"type":"directory",
"destination":null
}]
With JSON the Puppetserver returns:
[{
"checksum_type":"ctime",
"links":"follow",
"destination":null,
"source":null,
"group":10080,
"ftype":"directory",
"relative_path":".",
"expiration":"2019-02-11T14:39:20.972+01:00",
"checksum":"{ctime}2019-02-11 11:02:06 +0100",
"stat_method":"stat",
"owner":0,
"mode":1517,
"content_uri":null,
"source_permissions":"use",
"path":"/etc/puppetlabs/code/environments/test/modules"
}]
It then tries to call ftype=(value) on an object of
Puppet::FileServing::Metadata (as the error message says) but that
attribute only has an attribute reader:
https://github.com/puppetlabs/puppet/blob/41760e1646ffd91942ebc2290b5108ce31fe529d/lib/puppet/file_serving/metadata.rb#L16
Clearly something very strange is going on here. This can't be the real
issue as it obviously works for other people. Maybe someone on this list
has any idea how to track this down further or has encountered a similar
issue.
Regards
Andreas