From 986bf8b02d254334a6c3f22f18be5769e02a9c3a Mon Sep 17 00:00:00 2001 From: juniorsysadmin Date: Tue, 10 Jun 2014 16:42:06 +1000 Subject: [PATCH] Allow custom comment for sources list --- manifests/source.pp | 1 + spec/defines/source_spec.rb | 7 ++++++- templates/source.list.erb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/source.pp b/manifests/source.pp index 196fc92..dd00adc 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -2,6 +2,7 @@ # add an apt source define apt::source( + $comment = $name, $ensure = present, $location = '', $release = 'UNDEF', diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index bf5e50e..7c7ae39 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -74,7 +74,12 @@ describe 'apt::source', :type => :define do end let :content do - content = "#file generated by puppet\n# #{title}" + content = "#file generated by puppet\n" + if param_hash[:comment] + content << "# #{comment}" + else + content << "# #{title}" + end if param_hash[:architecture] arch = "[arch=#{param_hash[:architecture]}] " end diff --git a/templates/source.list.erb b/templates/source.list.erb index 541534e..a57244f 100644 --- a/templates/source.list.erb +++ b/templates/source.list.erb @@ -1,5 +1,5 @@ #file generated by puppet -# <%= @name %> +# <%= @comment %> deb <% if @architecture %>[arch=<%= @architecture %>] <% end %><%= @location %> <%= @release_real %> <%= @repos %> <%- if @include_src then -%> deb-src <% if @architecture %>[arch=<%= @architecture %>] <% end %><%= @location %> <%= @release_real %> <%= @repos %> -- 2.32.3