Skip to content
Merged
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
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@
default => 'present',
}

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

file { '/etc/apt/auth.conf':
ensure => $auth_conf_ensure,
owner => $auth_conf_owner,
group => 'root',
mode => '0600',
content => Sensitive("${confheadertmp}${auth_conf_tmp}"),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred function doesn't work well with interpolation as well as nested hash, so passing variable.

content => Sensitive($auth_conf_tmp),
notify => Class['apt::update'],
}
}
Expand Down
9 changes: 5 additions & 4 deletions spec/classes/apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@
super().merge(manage_auth_conf: true)
end

auth_conf_content = "// This file is managed by Puppet. DO NOT EDIT.
machine deb.example.net login foologin password secret
machine apt.example.com login aptlogin password supersecret
"
auth_conf_content = <<~CONTENT
// This file is managed by Puppet. DO NOT EDIT.
machine deb.example.net login foologin password secret
machine apt.example.com login aptlogin password supersecret
CONTENT

it {
expect(subject).to contain_file('/etc/apt/auth.conf').with(ensure: 'present',
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

it {
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',
id: GPG_KEY_ID,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant is not defined, cleanup of some old stuff.

id: id,
server: 'pgp.mit.edu',
content: 'GPG key content',
source: 'http://apt.puppetlabs.com/pubkey.gpg',
Expand Down
5 changes: 3 additions & 2 deletions templates/auth_conf.epp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<% if $apt::auth_conf_entries != [] { -%>
<% $apt::auth_conf_entries.each | $auth_conf_entry | { -%>
// This file is managed by Puppet. DO NOT EDIT.
<% if $auth_conf_entries != [] { -%>
<% $auth_conf_entries.each | $auth_conf_entry | { -%>
machine <%= $auth_conf_entry['machine'] %> login <%= $auth_conf_entry['login'] %> password <%= $auth_conf_entry['password'] %>
<% } -%>
<% } -%>