-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rich Data setting not respected when converting catalogs to data #9470
Comments
justinstoller
added a commit
to justinstoller/puppet
that referenced
this issue
Sep 3, 2024
justinstoller
added a commit
to justinstoller/puppet
that referenced
this issue
Sep 5, 2024
justinstoller
added a commit
to justinstoller/puppet
that referenced
this issue
Sep 5, 2024
Migrated issue to PUP-12077 |
justinstoller
added a commit
to justinstoller/puppet
that referenced
this issue
Sep 6, 2024
Since Puppet 6.0 "datafication" has inspected the context for the value of rich_data. However, in only some code paths does the value in the context get overridden with a value taken from the settings. This means in some cases the rich_data value will always be true or always be false, regardless of how the user has configured the rich_data setting. And, in the case the simply calling `to_data_hash` on a resource the rich_data value will always be false. This updates the base_context to set rich_data to the settings value, ensuring that the default value for rich_data in the context is the value users have set. Additional changes are primarily where tests still assumed the default value of rich_data was false, with one exception - YAML serialization in the resource application will break if the internal rich_data `__pcore` values are output. This forces rich_data to be false for that code path in the resource application. Fixes GH puppetlabs#9470
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: puppetlabs/puppetserver#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.
The text was updated successfully, but these errors were encountered: