-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the Bug
After upgrading to Puppet 8 I noticed a problem with my elasticsearch_license type https://github.com/voxpupuli/puppet-elasticsearch/blob/master/lib/puppet/type/elasticsearch_license.rb -> https://github.com/voxpupuli/puppet-elasticsearch/blob/master/lib/puppet_x/elastic/elasticsearch_rest_resource.rb#L25-L27)
Roughly used like this:
class foo (
$param, # set via Hiera
) {
elasticsearch_license { 'xpack':
password => $param.node_encrypt::secret,
# and some more parameters
}
}This works fine with Puppet 7 or with Puppet 8 + preprocess_deferred=true. In with preprocess_deferred=false, the API authentication to elasticsearch fails. In the provider I added a Puppet.debug(password) and I get:
#<Puppet::Pops::Evaluator::DeferredValue:0x00007feadcbc5858>
It feels like the resolution or executed of the deferred function happens too late? But not all resources are broken. A simple file resource works:
class foo (
$param, # set via Hiera
) {
file { 'xpack':
content => $param.node_encrypt::secret,
}
}This works, no matter if preprocess_deferred is true or false.
Expected Behavior
Deferred function should be evaluated before the type that uses the return value from the deferred function.
Steps to Reproduce
I don't have an easy to reproduce example at the moment. The Elasticsearch_license type requires a license and a working elasticsearch cluster.
Environment
- PE 2021.7.8 / PE 2023.7.0
Additional Context
- This was initially discussed at https://puppetcommunity.slack.com/archives/C0W298S9G/p1721232074454469
- Puppet 8 docs about preprocess_deferred are wrong: preprocess_deferred has the wrong default value for Puppet 8 puppet-docs#1166