diff --git a/manifests/instance.pp b/manifests/instance.pp index eb4b61de..3b18cfca 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -608,7 +608,7 @@ # TODO: Rely on https://github.com/puppetlabs/puppetlabs-stdlib/pull/1425 # once available. - if $_template_params.any |$value| { $value.is_a(Deferred) } { + if $_template_params.any |$_key, $_value| { $_value.is_a(Deferred) } { $_template_params_escaped = $_template_params.map | $_var , $_value | { if $_value.is_a(Deferred) { { $_var => "<%= \$${_var} %>" } diff --git a/spec/acceptance/suites/default/redis_deferred_spec.rb b/spec/acceptance/suites/default/redis_deferred_spec.rb new file mode 100644 index 00000000..102c941d --- /dev/null +++ b/spec/acceptance/suites/default/redis_deferred_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'spec_helper_acceptance' + +describe 'redis with deferred password' do + it 'configures and work with no errors' do + pp = <<-EOS + class { 'redis': + manage_repo => true, + redis_apt_repo => true, + port => 10001, + masterauth => Deferred('inline_epp',['<%= $pass %>\n',{'pass' => 'topsecret'}]), + } + EOS + + apply_manifest(pp, catch_failures: true, debug: true) + apply_manifest(pp, catch_changes: true, debug: true) + end + + describe command('redis-cli -p 10001 -a topsecret ping') do + its(:stdout) { is_expected.to match %r{PONG} } + end +end