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

Support for resolving Deferred values #740

Closed
genebean opened this issue Jan 23, 2019 · 1 comment
Closed

Support for resolving Deferred values #740

genebean opened this issue Jan 23, 2019 · 1 comment
Milestone

Comments

@genebean
Copy link

Testing code that includes the need to resolve a Deferred value does not seem to be possible with the current version of rspec-puppet. The issue is demonstrated in https://github.com/genebean/genebean-deferred_testing

@hlindberg
Copy link
Collaborator

The support for Deferred means that someone that gets a catalog must resolve any Deferred values in that catalog before it it is applied.
This is achieved by calling the following: Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog) where the resolver is given facts and the catalog.
The catalog will be mutated such that all Deferred and Binary data types are changed to the result of calling the deferred function and Binary values are changed to ASCII-8BIT encoded String values. It is possible to give nil as facts, but then there are no values in $facts which evaluation of deferred functions may depend on.

If resolution of deferred is not done, types and providers will receive values of those data types and the outcome will be something other than the expected.

A call to the DeferredResolver.resolve_and_replace can be done just before calling to_ral (that is what puppet apply does).

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

No branches or pull requests

3 participants