When calling to_data_hash on a catalog (and consequently on resources within that catalog) we do not respect the rich_data setting, instead of we lookup the value in the Context here, which defaults to false here.
Typically, catalogs go through our networking code, which will correctly chooses json vs application/vnd.puppet.rich+json mime types based on the request and local configuration (see here & here). So this is not a problem during most catalog compilations.
However, for CD4PE we go through an alternate compilation process which does not go through the networking serialization code, and expects the setting value rich_data to be respected. This has become an issue as Puppet 8 sets strict mode to error, and rich data types (like Deferreds) are becoming more popular.
Expected Behavior
The environment.conf / puppet.conf setting respected when calling Catalog.to_data_hash()
Steps to Reproduce
Do a CD4PE Impact Analysis on an environment with Deferred resources.
With a Puppet Server installed (I used the latest PE release):
Update the file /etc/puppetlabs/code/environments/production/manifests/site.pp to have a default node group of
Describe the Bug
When calling
to_data_hash
on a catalog (and consequently on resources within that catalog) we do not respect the rich_data setting, instead of we lookup the value in the Context here, which defaults to false here.Typically, catalogs go through our networking code, which will correctly chooses json vs application/vnd.puppet.rich+json mime types based on the request and local configuration (see here & here). So this is not a problem during most catalog compilations.
However, for CD4PE we go through an alternate compilation process which does not go through the networking serialization code, and expects the setting value rich_data to be respected. This has become an issue as Puppet 8 sets strict mode to error, and rich data types (like Deferreds) are becoming more popular.
Expected Behavior
The environment.conf / puppet.conf setting respected when calling Catalog.to_data_hash()
Steps to Reproduce
Do a CD4PE Impact Analysis on an environment with Deferred resources.
With a Puppet Server installed (I used the latest PE release): Update the file /etc/puppetlabs/code/environments/production/manifests/site.pp to have a default node group of
And then request a CD4PE catalog with:
I also have a unit test reproducer in Puppet Server here: https://github.com/puppetlabs/puppetserver/pull/2875
Environment
Additional Context
I would expect something like this to fix the issue:
But I have no idea if that would create more subtle problems than it solves.