]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge pull request #118 from opeckojo/apt-sources-arch
authorHunter Haugen <h.haugen@gmail.com>
Tue, 2 Jul 2013 18:48:06 +0000 (11:48 -0700)
committerHunter Haugen <h.haugen@gmail.com>
Tue, 2 Jul 2013 18:48:06 +0000 (11:48 -0700)
Add optional architecture qualifier to apt-sources

manifests/source.pp
spec/defines/source_spec.rb
templates/source.list.erb

index 9a358fe29c972e27a6cc9d8972f30d4c83e6c0ec..713c7e933ac1f75263fdffd09c7a056eb3161538 100644 (file)
@@ -12,7 +12,8 @@ define apt::source(
   $key_server        = 'keyserver.ubuntu.com',
   $key_content       = false,
   $key_source        = false,
-  $pin               = false
+  $pin               = false,
+  $architecture      = undef
 ) {
 
   include apt::params
index 32aa6c8dcb11d8ceae4c74857c5320acacdd50b0..0a8da3d5a6a70b433536050f8796cb6ff1b7d419 100644 (file)
@@ -48,6 +48,9 @@ describe 'apt::source', :type => :define do
     },
     {
       :release            => 'custom',
+    },
+    {
+      :architecture       => 'amd64',
     }
   ].each do |param_set|
     describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
@@ -69,9 +72,13 @@ describe 'apt::source', :type => :define do
 
       let :content do
         content = "# #{title}"
-        content << "\ndeb #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
+        if param_hash[:architecture]
+          arch = "[arch=#{param_hash[:architecture]}]"
+        end
+        content << "\ndeb #{arch} #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
+
         if param_hash[:include_src]
-          content << "deb-src #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
+          content << "deb-src #{arch} #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
         end
         content
       end
index 65764b2612cac71780f8cbef50cb2b2d9faaf9d6..845b8ae161726ade3f617868362dfc9da975fec4 100644 (file)
@@ -1,5 +1,5 @@
 # <%= @name %>
-deb <%= @location %> <%= @release_real %> <%= @repos %>
+deb <% if @architecture %>[arch=<%= @architecture %>]<% end %> <%= @location %> <%= @release_real %> <%= @repos %>
 <%- if @include_src then -%>
-deb-src <%= @location %> <%= @release_real %> <%= @repos %>
+deb-src <% if @architecture %>[arch=<%= @architecture %>]<% end %> <%= @location %> <%= @release_real %> <%= @repos %>
 <%- end -%>