Skip to content

Commit a61c7c5

Browse files
authored
Merge pull request #828 from puppetlabs/redact-sensitive-content
2 parents 22c62fa + 657ef2b commit a61c7c5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/puppet/type/concat_file.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,12 @@ def should_content
208208
return @generated_content if @generated_content
209209

210210
@generated_content = ''
211+
@has_sensitive_content_fragments = false
211212
content_fragments = []
212213

213214
fragments.each do |r|
214215
content_fragments << ["#{r[:order]}___#{r[:name]}", fragment_content(r)]
216+
@has_sensitive_content_fragments ||= r.parameters[:content]&.sensitive
215217
end
216218

217219
sorted = if self[:order] == :numeric
@@ -354,6 +356,7 @@ def eval_generate
354356
content = should_content
355357

356358
catalog.resource("File[#{self[:path]}]")[:content] = content unless content.nil?
359+
catalog.resource("File[#{self[:path]}]").parameters[:content].sensitive = @has_sensitive_content_fragments
357360

358361
catalog.resource("File[#{self[:path]}]")[:ensure] = :absent if !self[:create_empty_file] && (content.nil? || content.empty?)
359362

0 commit comments

Comments
 (0)