deferrable epp function simplifying deferred templates#1253
deferrable epp function simplifying deferred templates#1253chelnak merged 5 commits intopuppetlabs:mainfrom
Conversation
This function will detect when it's passed a deferred function and will effectively defer itself rather than rendering a template directly. It does this by either returning a deferred inline_epp function with the template source and variables compiled into the catalot, or by rendering directly with epp and just returning that output.
|
I think this is the right UX for the purpose; basically an arg-for-arg wrapper for Wild future improvement idea: If we like this idea, there's a possibility we could modify the internals a bit to sub out the deferred arguments for |
|
@binford2k Looks like you have a failing lint check Also I wonder if we should have a spec test for this? |
| end | ||
| it { | ||
| foo = Puppet::Pops::Types::TypeFactory.deferred.create('join', [1,2,3]) | ||
| is_expected.to run.with_params('mymod/template.epp', {'foo' => foo }) #.and_return(a_kind_of Puppet::Pops::Evaluator::DeferredValue) |
There was a problem hiding this comment.
@joshcooper I couldn't quite get the return type here. Suggestions?
There was a problem hiding this comment.
Never mind. I figured out the return type and submitted an rspec-puppet PR to actually allow this matcher to work.
PR puppetlabs#637 uses stdlib::deferrable_epp that is only available in v8.4.0[1] [1] puppetlabs/puppetlabs-stdlib#1253 Change-Id: I455cec0ec1c6a2ec63b2ab0c19b2b7a2119f2f26
No description provided.