(MODULES-1200) Fix inconsistent header across files
authorStefan Dietrich <stefan.dietrich@desy.de>
Sun, 31 Aug 2014 13:46:57 +0000 (15:46 +0200)
committerStefan Dietrich <stefan.dietrich@desy.de>
Fri, 6 Feb 2015 20:16:05 +0000 (21:16 +0100)
18 files changed:
manifests/conf.pp
manifests/init.pp
manifests/pin.pp
manifests/release.pp
manifests/source.pp
manifests/unattended_upgrades.pp
spec/classes/apt_spec.rb
spec/classes/release_spec.rb
spec/defines/conf_spec.rb
spec/defines/source_spec.rb
templates/15update-stamp.erb [new file with mode: 0644]
templates/_header.erb [new file with mode: 0644]
templates/conf.erb [new file with mode: 0644]
templates/progressbar.erb [new file with mode: 0644]
templates/proxy.erb [new file with mode: 0644]
templates/release.erb [new file with mode: 0644]
templates/source.list.erb
templates/unauth.erb [new file with mode: 0644]

index 3c4cb1975cb3551a1a642f2155111e0932a118e2..318422e29323933eb2b8f3d315037e421d4d1a4c 100644 (file)
@@ -10,7 +10,7 @@ define apt::conf (
 
   file { "${apt_conf_d}/${priority}${name}":
     ensure  => $ensure,
-    content => $content,
+    content => template('apt/_header.erb', 'apt/conf.erb'),
     owner   => root,
     group   => root,
     mode    => '0644',
index d64b013accbbaa3e1bb1ba3f34e17672ce798cc3..5f33fdba703920ddf94d2ea540ffc4ef2ed3497c 100644 (file)
@@ -92,7 +92,7 @@ class apt(
 
   file { '/etc/apt/apt.conf.d/15update-stamp':
     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',
     mode    => '0644',
     owner   => 'root',
@@ -144,7 +144,7 @@ class apt(
     true: {
       file { '99progressbar':
         ensure  => present,
-        content => 'Dpkg::Progress-Fancy "1";',
+        content => template('apt/_header.erb', 'apt/progressbar.erb'),
         path    => "${apt_conf_d}/99progressbar",
       }
     }
@@ -162,7 +162,7 @@ class apt(
     true: {
       file { '99unauth':
         ensure  => present,
-        content => "APT::Get::AllowUnauthenticated 1;\n",
+        content => template('apt/_header.erb', 'apt/unauth.erb'),
         path    => "${apt_conf_d}/99unauth",
       }
     }
@@ -188,7 +188,7 @@ class apt(
       file { '01proxy':
         ensure  => present,
         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'],
         mode    => '0644',
         owner   => root,
index 54961ec8ddfa7e43fae6109efc44daa414e5c89d..935dc226e55bdffb7adebefec965d7b4935859c1 100644 (file)
@@ -76,6 +76,6 @@ define apt::pin(
     owner   => root,
     group   => root,
     mode    => '0644',
-    content => template('apt/pin.pref.erb'),
+    content => template('apt/_header.erb', 'apt/pin.pref.erb'),
   }
 }
index 6e0a38f73f7889cdc21ce3193c9440dddc3eb797..ae12dd4fb20cfccd48904ff84363ab16903c1ffd 100644 (file)
@@ -12,6 +12,6 @@ class apt::release (
     owner   => root,
     group   => root,
     mode    => '0644',
-    content => "APT::Default-Release \"${release_id}\";"
+    content => template('apt/_header.erb', 'apt/release.erb'),
   }
 }
index c5ed3a640289d30b1362e1b5a789fc1645e9fb68..f6647dfe76b1021e645871711d6a8e9a11b6af57 100644 (file)
@@ -44,7 +44,7 @@ define apt::source(
     owner   => root,
     group   => root,
     mode    => '0644',
-    content => template("${module_name}/source.list.erb"),
+    content => template('apt/_header.erb', 'apt/source.list.erb'),
     notify  => Exec['apt_update'],
   }
 
index 069c3593dd627ebd6207f595e5633540b248f021..b835b9a6a5ed57483175739eda3cf8929e292c75 100644 (file)
@@ -64,7 +64,7 @@ class apt::unattended_upgrades (
     owner   => 'root',
     group   => 'root',
     mode    => '0644',
-    content => template('apt/50unattended-upgrades.erb'),
+    content => template('apt/_header.erb', 'apt/50unattended-upgrades.erb'),
     require => Package['unattended-upgrades'],
   }
 
@@ -73,7 +73,7 @@ class apt::unattended_upgrades (
     owner   => 'root',
     group   => 'root',
     mode    => '0644',
-    content => template('apt/10periodic.erb'),
+    content => template('apt/_header.erb', 'apt/10periodic.erb'),
     require => Package['unattended-upgrades'],
   }
 }
index 0a1c0a1bd79e4a62cfd2472337fae3b31800949b..f65ed030936cff8a1230d09a5de31a54eaf3c473 100644 (file)
@@ -42,7 +42,7 @@ describe 'apt', :type => :class do
         'group' => 'root',
         'mode'  => '0644',
         '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
 
     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({
       'ensure'  => 'present',
-      'content' => 'Dpkg::Progress-Fancy "1";',
+      'content' => /Dpkg::Progress-Fancy "1";/,
       'path'    => '/etc/apt/apt.conf.d/99progressbar',
     })}
 
     it { should contain_file('99unauth').only_with({
       'ensure'  => 'present',
-      'content' => "APT::Get::AllowUnauthenticated 1;\n",
+      'content' => /APT::Get::AllowUnauthenticated 1;/,
       'path'    => '/etc/apt/apt.conf.d/99unauth',
     })}
 
     it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
       'ensure'  => 'present',
       '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]',
       'mode'    => '0644',
       'owner'   => 'root',
index e43f449d62689907d63a6ea0e2a86e2414db4d1d..f8c6512840f4322f5e3f64ceae167bbbc8c6a72e 100644 (file)
@@ -16,7 +16,7 @@ describe 'apt::release', :type => :class do
       "mode"    => "0644",
       "owner"   => "root",
       "group"   => "root",
-      "content" => "APT::Default-Release \"#{param_set[:release_id]}\";"
+      "content" => /APT::Default-Release "#{param_set[:release_id]}";/
     })
   }
 end
index ec4e229c4449f5122f340ce61a16bc60cd82ff09..2c1752f074cb301741edc771a4ba3420bae950b0 100644 (file)
@@ -19,7 +19,7 @@ describe 'apt::conf', :type => :define do
 
     it { should contain_file(filename).with({
           'ensure'    => 'present',
-          'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
+          'content'   => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
           'owner'     => 'root',
           'group'     => 'root',
           'mode'      => '0644',
@@ -42,7 +42,7 @@ describe 'apt::conf', :type => :define do
 
     it { should contain_file(filename).with({
         'ensure'    => 'absent',
-        'content'   => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n",
+        'content'   => /Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;/,
         'owner'     => 'root',
         'group'     => 'root',
         'mode'      => '0644',
index b4d379902ddf49fb1bf37865c64ecbdc0138217f..8ca7f8e20308f763910b800e60c6c41db9a32d72 100644 (file)
@@ -29,7 +29,7 @@ describe 'apt::source', :type => :define do
       'owner'  => 'root',
       'group'  => 'root',
       '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
 
@@ -65,7 +65,7 @@ describe 'apt::source', :type => :define do
       'owner'  => 'root',
       'group'  => 'root',
       '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({
@@ -115,7 +115,7 @@ describe 'apt::source', :type => :define do
       'owner'  => 'root',
       'group'  => 'root',
       '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
 
@@ -140,7 +140,7 @@ describe 'apt::source', :type => :define do
       'owner'  => 'root',
       'group'  => 'root',
       '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
  
diff --git a/templates/15update-stamp.erb b/templates/15update-stamp.erb
new file mode 100644 (file)
index 0000000..14ead83
--- /dev/null
@@ -0,0 +1 @@
+APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};
diff --git a/templates/_header.erb b/templates/_header.erb
new file mode 100644 (file)
index 0000000..487e581
--- /dev/null
@@ -0,0 +1 @@
+# This file is managed by Puppet. DO NOT EDIT.
diff --git a/templates/conf.erb b/templates/conf.erb
new file mode 100644 (file)
index 0000000..a35d1d4
--- /dev/null
@@ -0,0 +1 @@
+<%= @content -%>
diff --git a/templates/progressbar.erb b/templates/progressbar.erb
new file mode 100644 (file)
index 0000000..d3d9278
--- /dev/null
@@ -0,0 +1 @@
+Dpkg::Progress-Fancy "1";
diff --git a/templates/proxy.erb b/templates/proxy.erb
new file mode 100644 (file)
index 0000000..accb0cc
--- /dev/null
@@ -0,0 +1 @@
+Acquire::http::Proxy "http://<%= @proxy_host %>:<%= @proxy_port %>";
diff --git a/templates/release.erb b/templates/release.erb
new file mode 100644 (file)
index 0000000..08760af
--- /dev/null
@@ -0,0 +1 @@
+APT::Default-Release "<%= @release_id %>";
index 75147667b50eaf61a6fbe510caa2def1be984777..b50be8d1fd7601b3e2d4289d5f28f88793eb4962 100644 (file)
@@ -1,4 +1,3 @@
-#file generated by puppet
 # <%= @comment %>
 <%- if @include_deb then -%>
 deb <%- if @architecture or @trusted_source -%>
diff --git a/templates/unauth.erb b/templates/unauth.erb
new file mode 100644 (file)
index 0000000..77edd28
--- /dev/null
@@ -0,0 +1 @@
+APT::Get::AllowUnauthenticated 1;