Omit empty options in source.list template to fix MODULES-11174
authorMatthias Pigulla <mp@webfactory.de>
Sun, 9 Jan 2022 22:51:55 +0000 (23:51 +0100)
committerGitHub <noreply@github.com>
Sun, 9 Jan 2022 22:51:55 +0000 (23:51 +0100)
Empty `[name= ...]` options in a soures list lead to Apt parsing errors.

This change skips such empty options, resolving https://tickets.puppetlabs.com/browse/MODULES-11174.

templates/source.list.epp

index 5924c8f84c1c6c48019b22514980e70f3f16b7c5..2b8dd6e57d04b40d3d18b4927c291f1fdccbe8e8 100644 (file)
@@ -1,8 +1,8 @@
 <%- | String $comment, Hash $includes, Hash $options, $location, $release, String $repos | -%>
 # <%= $comment %>
 <%- if $includes['deb'] { -%>
-deb <% if !$options.empty() { -%>[<%=  $options.map |$key, $value| { "${key}=${value}" }.join(" ") %>] <% } -%> <%= $location %> <%= $release %> <%= $repos %>
+deb <% if !$options.empty() { -%>[<%=  $options.map |$key, $value| { if !$value.empty() { "${key}=${value}" } }.join(" ") %>] <% } -%> <%= $location %> <%= $release %> <%= $repos %>
 <%- } -%>
 <%- if $includes['src'] { -%>
-deb-src <% if !$options.empty() { -%>[<%=  $options.map |$key, $value| { "${key}=${value}" }.join(" ") %>] <% } -%> <%= $location %> <%= $release %> <%= $repos %>
+deb-src <% if !$options.empty() { -%>[<%=  $options.map |$key, $value| { if !$value.empty() { "${key}=${value}" } }.join(" ") %>] <% } -%> <%= $location %> <%= $release %> <%= $repos %>
 <%- } -%>