Skip to content

Commit 1b322c4

Browse files
nrhallamitkarsale
authored andcommitted
Allow any sensitive type so that Sensitive(Deferred(...)) values can be passed to concat::fragment
1 parent 92f69cc commit 1b322c4

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

manifests/fragment.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
# Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource.
1818
#
1919
define concat::fragment (
20-
String $target,
21-
Optional[Variant[Sensitive[String], String, Deferred]] $content = undef,
22-
Optional[Variant[String, Array]] $source = undef,
23-
Variant[String, Integer] $order = '10',
20+
String $target,
21+
Optional[Variant[Sensitive, String, Deferred]] $content = undef,
22+
Optional[Variant[String, Array]] $source = undef,
23+
Variant[String, Integer] $order = '10',
2424
) {
2525
$resource = 'Concat::Fragment'
2626

spec/acceptance/fragment_content_with_deferred_function_call_spec.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@basedir = setup_test_directory
1313
end
1414

15-
describe 'file' do
15+
describe 'deferred file' do
1616
let(:pp) do
1717
<<-MANIFEST
1818
concat { '#{basedir}/deferred_file': }
@@ -30,4 +30,24 @@
3030
expect(file("#{basedir}/deferred_file").content).to match Digest::MD5.hexdigest('test')
3131
end
3232
end
33+
34+
describe 'sensitive deferred file' do
35+
let(:pp) do
36+
<<-MANIFEST
37+
concat { '#{basedir}/sensitive_deferred_file': }
38+
39+
concat::fragment { '1':
40+
target => '#{basedir}/sensitive_deferred_file',
41+
content => Sensitive(Deferred('md5', ['test'])),
42+
}
43+
MANIFEST
44+
end
45+
46+
it 'idempotent, file matches' do
47+
idempotent_apply(pp)
48+
expect(file("#{basedir}/sensitive_deferred_file")).to be_file
49+
expect(file("#{basedir}/sensitive_deferred_file").content).to match Digest::MD5.hexdigest('test')
50+
end
51+
end
52+
3353
end

0 commit comments

Comments
 (0)