| Puppet Version: 7.24.0 Puppet Server Version: n/a OS Name/Version: n/a The Problem Using a Deferred inline_epp() to render Sensitive content while using --no-preprocess_deferred throws the following error message:
Error: Failed to apply catalog: Munging failed for value #<Sensitive [value redacted]> in class content: no implicit conversion of Puppet::Pops::Types::PSensitiveType::Sensitive into String
|
Reproduction Given this Puppet code:
$cert = Sensitive('hello') |
$intermediate = Sensitive('world') |
$chain = Deferred('inline_epp', ["<%= \$cert %>\n<%= \$intermediate %>\n", { |
'cert' => $cert, |
'intermediate' => $intermediate, |
}]) |
|
file { '/tmp/test_chain.pem': |
ensure => 'file', |
content => $chain, |
}
|
With Puppet 7.24.0 and the --no-preprocess_deferred option, apply the manifest above:
$ puppet apply test.pp --no-preprocess_deferred |
Notice: Compiled catalog for nate in environment production in 0.01 seconds |
Error: Failed to apply catalog: Munging failed for value #<Sensitive [value redacted]> in class content: no implicit conversion of Puppet::Pops::Types::PSensitiveType::Sensitive into String
|
Running puppet apply without --no-preprocess_deferred succeeds:
$ puppet apply test.pp |
Notice: Compiled catalog for nate in environment production in 0.01 seconds |
Notice: /Stage[main]/Main/File[/tmp/test_chain.pem]/ensure: changed [redacted] to [redacted] |
Notice: Applied catalog in 0.01 seconds
|
More Info I also found that I can fix the problem by not using inline_epp(). If I change the $chain variable to be built with join(), it works:
# This isn't ideal because the file needs a trailing newline, which join() can't do. |
$chain = Sensitive(Deferred('join', [[$cert.unwrap, $intermediate.unwrap], "\n"]))
|
|