]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
pin: Fix the template.
authorDaniele Sluijters <github@daenney.net>
Fri, 28 Mar 2014 07:47:19 +0000 (08:47 +0100)
committerDaniele Sluijters <github@daenney.net>
Fri, 28 Mar 2014 07:47:19 +0000 (08:47 +0100)
In APT preferences files the only allowed comments are lines that start
with `Explanation:`, commented lines that start with a # trigger a
myriad of interesting bugs. This is considered a feature of APT.

Because we're only ever writing a single file at a time with only a #
comment at the top we were getting away with this but it shouldn't be
there in the first place.

spec/defines/pin_spec.rb
templates/pin.pref.erb

index 6438e8cbee46a7ce1c244fa8f3346b42287e2dfa..d79462cd48ad4cb7a1cccaa50ef499e252725027 100644 (file)
@@ -15,14 +15,14 @@ describe 'apt::pin', :type => :define do
 
   [
     { :params  => {},
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n"
+      :content => "Explanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n"
     },
     {
       :params => {
         :packages => 'apache',
         :priority => '1'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
     },
     {
       :params => {
@@ -30,7 +30,7 @@ describe 'apt::pin', :type => :define do
         :packages => 'apache',
         :priority => '1'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
     },
     {
       :params => {
@@ -38,7 +38,7 @@ describe 'apt::pin', :type => :define do
         :packages => 'apache',
         :priority => '1'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n"
     },
     {
       :params => {
@@ -46,7 +46,7 @@ describe 'apt::pin', :type => :define do
         :priority => '1',
         :release  => 'my_newpin'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n"
     },
     {
       :params => {
@@ -54,14 +54,14 @@ describe 'apt::pin', :type => :define do
         :priority => '1',
         :version  => '2.2.16*'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n"
     },
     {
       :params => {
         :priority => '1',
         :origin   => 'ftp.de.debian.org'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin ftp.de.debian.org\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: *\nPin: origin ftp.de.debian.org\nPin-Priority: 1\n"
     },
     {
       :params => {
@@ -74,13 +74,13 @@ describe 'apt::pin', :type => :define do
         :originator      => 'Debian',
         :label           => 'Debian'
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n"
+      :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n"
     },
     {
       :params => {
         :packages        => ['apache', 'ntop'],
       },
-      :content => "# my_pin\nExplanation: : my_pin\nPackage: apache ntop\nPin: release a=my_pin\nPin-Priority: 0\n"
+      :content => "Explanation: : my_pin\nPackage: apache ntop\nPin: release a=my_pin\nPin-Priority: 0\n"
     },
   ].each do |param_set|
     describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do
index a19e2536fcb4db6d9bdd961ea56571d9a16bba87..26b2516c47e9986edbbdefe5a225c6273c4f1c3d 100644 (file)
@@ -15,7 +15,6 @@ elsif @origin.length > 0
   @pin = "origin #{@origin}"
 end
 -%>
-# <%= @name %>
 Explanation: <%= @explanation %>
 Package: <%= @packages_string %>
 Pin: <%= @pin %>