Skip to content

Commit 91c8762

Browse files
authored
Merge pull request #1110 from puppetlabs/CONT-581
(CONT-581) Adding deferred function support for password field
2 parents 6ccd955 + cd1b95b commit 91c8762

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

manifests/init.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,14 @@
366366
default => 'present',
367367
}
368368

369-
$auth_conf_tmp = epp('apt/auth_conf.epp')
369+
$auth_conf_tmp = stdlib::deferrable_epp('apt/auth_conf.epp', { 'auth_conf_entries' => $auth_conf_entries })
370370

371371
file { '/etc/apt/auth.conf':
372372
ensure => $auth_conf_ensure,
373373
owner => $auth_conf_owner,
374374
group => 'root',
375375
mode => '0600',
376-
content => Sensitive("${confheadertmp}${auth_conf_tmp}"),
376+
content => Sensitive($auth_conf_tmp),
377377
notify => Class['apt::update'],
378378
}
379379
}

spec/classes/apt_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,11 @@
415415
super().merge(manage_auth_conf: true)
416416
end
417417

418-
auth_conf_content = "// This file is managed by Puppet. DO NOT EDIT.
419-
machine deb.example.net login foologin password secret
420-
machine apt.example.com login aptlogin password supersecret
421-
"
418+
auth_conf_content = <<~CONTENT
419+
// This file is managed by Puppet. DO NOT EDIT.
420+
machine deb.example.net login foologin password secret
421+
machine apt.example.com login aptlogin password supersecret
422+
CONTENT
422423

423424
it {
424425
expect(subject).to contain_file('/etc/apt/auth.conf').with(ensure: 'present',

spec/defines/source_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130

131131
it {
132132
expect(subject).to contain_apt__key("Add key: #{id} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with(ensure: 'refreshed',
133-
id: GPG_KEY_ID,
133+
id: id,
134134
server: 'pgp.mit.edu',
135135
content: 'GPG key content',
136136
source: 'http://apt.puppetlabs.com/pubkey.gpg',

templates/auth_conf.epp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<% if $apt::auth_conf_entries != [] { -%>
2-
<% $apt::auth_conf_entries.each | $auth_conf_entry | { -%>
1+
// This file is managed by Puppet. DO NOT EDIT.
2+
<% if $auth_conf_entries != [] { -%>
3+
<% $auth_conf_entries.each | $auth_conf_entry | { -%>
34
machine <%= $auth_conf_entry['machine'] %> login <%= $auth_conf_entry['login'] %> password <%= $auth_conf_entry['password'] %>
45
<% } -%>
56
<% } -%>

0 commit comments

Comments
 (0)