Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions manifests/fragment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource.
#
define concat::fragment (
String $target,
Optional[Variant[Sensitive[String], String, Deferred]] $content = undef,
Optional[Variant[String, Array]] $source = undef,
Variant[String, Integer] $order = '10',
String $target,
Optional[Variant[Sensitive, String, Deferred]] $content = undef,
Optional[Variant[String, Array]] $source = undef,
Variant[String, Integer] $order = '10',
) {
$resource = 'Concat::Fragment'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@basedir = setup_test_directory
end

describe 'file' do
describe 'deferred file' do
let(:pp) do
<<-MANIFEST
concat { '#{basedir}/deferred_file': }
Expand All @@ -30,4 +30,24 @@
expect(file("#{basedir}/deferred_file").content).to match Digest::MD5.hexdigest('test')
end
end

describe 'sensitive deferred file' do
let(:pp) do
<<-MANIFEST
concat { '#{basedir}/sensitive_deferred_file': }

concat::fragment { '1':
target => '#{basedir}/sensitive_deferred_file',
content => Sensitive(Deferred('md5', ['test'])),
}
MANIFEST
end

it 'idempotent, file matches' do
idempotent_apply(pp)
expect(file("#{basedir}/sensitive_deferred_file")).to be_file
expect(file("#{basedir}/sensitive_deferred_file").content).to match Digest::MD5.hexdigest('test')
end
end

end