(MODULES-1200) Fix inconsistent header across files

This commit is contained in:
Stefan Dietrich 2014-08-31 15:46:57 +02:00
parent bf9b187405
commit 443db5a7c2
18 changed files with 28 additions and 22 deletions

View file

@ -10,7 +10,7 @@ define apt::conf (
file { "${apt_conf_d}/${priority}${name}": file { "${apt_conf_d}/${priority}${name}":
ensure => $ensure, ensure => $ensure,
content => $content, content => template('apt/_header.erb', 'apt/conf.erb'),
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',

View file

@ -92,7 +92,7 @@ class apt(
file { '/etc/apt/apt.conf.d/15update-stamp': file { '/etc/apt/apt.conf.d/15update-stamp':
ensure => 'file', ensure => 'file',
content => 'APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};', content => template('apt/_header.erb', 'apt/15update-stamp.erb'),
group => 'root', group => 'root',
mode => '0644', mode => '0644',
owner => 'root', owner => 'root',
@ -144,7 +144,7 @@ class apt(
true: { true: {
file { '99progressbar': file { '99progressbar':
ensure => present, ensure => present,
content => 'Dpkg::Progress-Fancy "1";', content => template('apt/_header.erb', 'apt/progressbar.erb'),
path => "${apt_conf_d}/99progressbar", path => "${apt_conf_d}/99progressbar",
} }
} }
@ -162,7 +162,7 @@ class apt(
true: { true: {
file { '99unauth': file { '99unauth':
ensure => present, ensure => present,
content => "APT::Get::AllowUnauthenticated 1;\n", content => template('apt/_header.erb', 'apt/unauth.erb'),
path => "${apt_conf_d}/99unauth", path => "${apt_conf_d}/99unauth",
} }
} }
@ -188,7 +188,7 @@ class apt(
file { '01proxy': file { '01proxy':
ensure => present, ensure => present,
path => "${apt_conf_d}/01proxy", path => "${apt_conf_d}/01proxy",
content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n", content => template('apt/_header.erb', 'apt/proxy.erb'),
notify => Exec['apt_update'], notify => Exec['apt_update'],
mode => '0644', mode => '0644',
owner => root, owner => root,

View file

@ -76,6 +76,6 @@ define apt::pin(
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
content => template('apt/pin.pref.erb'), content => template('apt/_header.erb', 'apt/pin.pref.erb'),
} }
} }

View file

@ -12,6 +12,6 @@ class apt::release (
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
content => "APT::Default-Release \"${release_id}\";" content => template('apt/_header.erb', 'apt/release.erb'),
} }
} }

View file

@ -44,7 +44,7 @@ define apt::source(
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
content => template("${module_name}/source.list.erb"), content => template('apt/_header.erb', 'apt/source.list.erb'),
notify => Exec['apt_update'], notify => Exec['apt_update'],
} }

View file

@ -64,7 +64,7 @@ class apt::unattended_upgrades (
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
content => template('apt/50unattended-upgrades.erb'), content => template('apt/_header.erb', 'apt/50unattended-upgrades.erb'),
require => Package['unattended-upgrades'], require => Package['unattended-upgrades'],
} }
@ -73,7 +73,7 @@ class apt::unattended_upgrades (
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
content => template('apt/10periodic.erb'), content => template('apt/_header.erb', 'apt/10periodic.erb'),
require => Package['unattended-upgrades'], require => Package['unattended-upgrades'],
} }
} }

View file

@ -42,7 +42,7 @@ describe 'apt', :type => :class do
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
'owner' => 'root', 'owner' => 'root',
}).with_content('APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};') }).with_content(/APT::Update::Post-Invoke-Success \{"touch \/var\/lib\/apt\/periodic\/update-success-stamp 2>\/dev\/null \|\| true";\};/)
end end
it { should contain_file('old-proxy-file').that_notifies('Exec[apt_update]').only_with({ it { should contain_file('old-proxy-file').that_notifies('Exec[apt_update]').only_with({
@ -94,20 +94,20 @@ describe 'apt', :type => :class do
it { should contain_file('99progressbar').only_with({ it { should contain_file('99progressbar').only_with({
'ensure' => 'present', 'ensure' => 'present',
'content' => 'Dpkg::Progress-Fancy "1";', 'content' => /Dpkg::Progress-Fancy "1";/,
'path' => '/etc/apt/apt.conf.d/99progressbar', 'path' => '/etc/apt/apt.conf.d/99progressbar',
})} })}
it { should contain_file('99unauth').only_with({ it { should contain_file('99unauth').only_with({
'ensure' => 'present', 'ensure' => 'present',
'content' => "APT::Get::AllowUnauthenticated 1;\n", 'content' => /APT::Get::AllowUnauthenticated 1;/,
'path' => '/etc/apt/apt.conf.d/99unauth', 'path' => '/etc/apt/apt.conf.d/99unauth',
})} })}
it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({ it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
'ensure' => 'present', 'ensure' => 'present',
'path' => '/etc/apt/apt.conf.d/01proxy', 'path' => '/etc/apt/apt.conf.d/01proxy',
'content' => "Acquire::http::Proxy \"http://foo:9876\";\n", 'content' => /Acquire::http::Proxy "http:\/\/foo:9876";/,
'notify' => 'Exec[apt_update]', 'notify' => 'Exec[apt_update]',
'mode' => '0644', 'mode' => '0644',
'owner' => 'root', 'owner' => 'root',

View file

@ -16,7 +16,7 @@ describe 'apt::release', :type => :class do
"mode" => "0644", "mode" => "0644",
"owner" => "root", "owner" => "root",
"group" => "root", "group" => "root",
"content" => "APT::Default-Release \"#{param_set[:release_id]}\";" "content" => /APT::Default-Release "#{param_set[:release_id]}";/
}) })
} }
end end

View file

@ -19,7 +19,7 @@ describe 'apt::conf', :type => :define do
it { should contain_file(filename).with({ it { should contain_file(filename).with({
'ensure' => 'present', 'ensure' => 'present',
'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", 'content' => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
@ -42,7 +42,7 @@ describe 'apt::conf', :type => :define do
it { should contain_file(filename).with({ it { should contain_file(filename).with({
'ensure' => 'absent', 'ensure' => 'absent',
'content' => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n", 'content' => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',

View file

@ -29,7 +29,7 @@ describe 'apt::source', :type => :define do
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
}).with_content(/#file generated by puppet\n# my_source\ndeb-src wheezy main\n/) }).with_content(/# my_source\ndeb-src wheezy main\n/)
} }
end end
@ -65,7 +65,7 @@ describe 'apt::source', :type => :define do
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
}).with_content(/#file generated by puppet\n# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/) }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
} }
it { is_expected.to contain_apt__pin('my_source').that_comes_before('File[my_source.list]').with({ it { is_expected.to contain_apt__pin('my_source').that_comes_before('File[my_source.list]').with({
@ -115,7 +115,7 @@ describe 'apt::source', :type => :define do
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
}).with_content(/#file generated by puppet\n# my_source\ndeb \[trusted=yes\] wheezy main\n/) }).with_content(/# my_source\ndeb \[trusted=yes\] wheezy main\n/)
} }
end end
@ -140,7 +140,7 @@ describe 'apt::source', :type => :define do
'owner' => 'root', 'owner' => 'root',
'group' => 'root', 'group' => 'root',
'mode' => '0644', 'mode' => '0644',
}).with_content(/#file generated by puppet\n# my_source\ndeb-src \[arch=x86_64 \] wheezy main\n/) }).with_content(/# my_source\ndeb-src \[arch=x86_64 \] wheezy main\n/)
} }
end end

View file

@ -0,0 +1 @@
APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};

1
templates/_header.erb Normal file
View file

@ -0,0 +1 @@
# This file is managed by Puppet. DO NOT EDIT.

1
templates/conf.erb Normal file
View file

@ -0,0 +1 @@
<%= @content -%>

View file

@ -0,0 +1 @@
Dpkg::Progress-Fancy "1";

1
templates/proxy.erb Normal file
View file

@ -0,0 +1 @@
Acquire::http::Proxy "http://<%= @proxy_host %>:<%= @proxy_port %>";

1
templates/release.erb Normal file
View file

@ -0,0 +1 @@
APT::Default-Release "<%= @release_id %>";

View file

@ -1,4 +1,3 @@
#file generated by puppet
# <%= @comment %> # <%= @comment %>
<%- if @include_deb then -%> <%- if @include_deb then -%>
deb <%- if @architecture or @trusted_source -%> deb <%- if @architecture or @trusted_source -%>

1
templates/unauth.erb Normal file
View file

@ -0,0 +1 @@
APT::Get::AllowUnauthenticated 1;