Skip to content
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

Enable catalog access feature #284

Closed
wants to merge 4 commits into from
Closed

Enable catalog access feature #284

wants to merge 4 commits into from

Conversation

kreeuwijk
Copy link

This PR enables setting a raw_catalog_access feature flag on the type, which then provides access to the catalog in the provider by using context.catalog.

@kreeuwijk kreeuwijk changed the title Enable catalog access feature (#242) Enable catalog access feature Mar 30, 2021
Copy link
Contributor

@DavidS DavidS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On preliminary testing, the class-level context doesn't have access to the catalog, but is used during instances for calling get. This makes me think that I'm not fully understanding the object lifecycle around this, making me afraid of either running into issues where the catalog is not yet available (as the unit tests flag up) or the catalog leaks through the agent process across multiple invocations.

This is also limited in that the catalog is not available during puppet resource calls. While providers need to be prepared to handle this (and we need to call it out in docs), I don't think there's any way around this, as puppet resource just doesn't have a catalog.

Overall this will need a bit more investigation/exploration/change before we can merge it.

lib/puppet/resource_api/base_context.rb Outdated Show resolved Hide resolved
lib/puppet/resource_api.rb Outdated Show resolved Hide resolved
kreeuwijk and others added 4 commits May 17, 2021 11:53
This commit updates the BaseContext class initialization method
to take a second argument, catalog (default to nil), which
ensures that the @catalog instance variable is populated with
the value passed.

It also updates the context method in resource_api to pass the
catalog to that initializer if specified, or pass nil if not.

This does not add unit or acceptance tests for the behavior.
@michaeltlombardi
Copy link
Contributor

@kreeuwijk I did a minor fixup to get existing tests passing and manually validated that things are working, but I think we'll need some more extensive testing (acceptance and unit alike) and noodling out to be sure there's no weird side effects or changing during a run.

@DavidS
Copy link
Contributor

DavidS commented May 18, 2021

Testing this might be a bit tricky as this will require a running puppet agent service and then verifying that the catalog from the first run doesn't leak into the subsequent runs. Not really sure how to set this up properly.

@jpogran
Copy link
Contributor

jpogran commented Jun 15, 2021

With the inability to add automated tests at the moment, the risk of adding a new API surface that exposes an advanced raw access to the catalog which is contrary to the purpose of this simpler API, and the uncertainty of the clear purpose/need for the feature I am closing this PR. Thank you for your contribution, if you feel this should be included please reach out to myself and @binford2k

@jpogran jpogran closed this Jun 15, 2021
@donoghuc donoghuc deleted the catalog_access branch June 6, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants