pin: Fix the template.

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.
This commit is contained in:
Daniele Sluijters 2014-03-28 08:47:19 +01:00
parent 543f0ccefa
commit 9f59f1b33a
2 changed files with 9 additions and 10 deletions

View 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

View file

@ -15,7 +15,6 @@ elsif @origin.length > 0
@pin = "origin #{@origin}"
end
-%>
# <%= @name %>
Explanation: <%= @explanation %>
Package: <%= @packages_string %>
Pin: <%= @pin %>