only consider lsbdistcodename for apt-transport-https
authorAntoine Beaupré <anarcat@debian.org>
Wed, 12 Feb 2020 19:03:15 +0000 (14:03 -0500)
committerAntoine Beaupré <anarcat@debian.org>
Wed, 12 Feb 2020 19:03:15 +0000 (14:03 -0500)
It does not matter if we have *one* older source from (say) jessie or
stretch, we could still be running buster or later. The latter is more
reliably indicated by the fact than by the provided "release"
parameter, which is really just an arbitrary string that does not
necessarily match a Debian suite, especially for third-party
repositories.

I have had a problem with this setting when deploying a "stretch"
repository on a "buster" system because I needed to keep MongoDB
running (which is gone from buster). The "stretch" line triggered this
line, which conflicted with a `ensure_packages` I had elsewhere in our
code base, to *remove* the `apt-transport-https` package from buster
and later.

An alternative implementation might prefer to remove the package
unconditionnally if we run a newer release, but I figured I would keep
the changes to a minimum.

manifests/source.pp

index 3b0b06b3d54a29ae71f78efd98ccc245f567364b..cb75635797ca882832467d64be7d8228b86765aa 100644 (file)
@@ -88,7 +88,7 @@ define apt::source(
     }
     # Newer oses, do not need the package for HTTPS transport.
     $_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ]
-    if ($_release in $_transport_https_releases or $facts['lsbdistcodename'] in $_transport_https_releases) and $location =~ /(?i:^https:\/\/)/ {
+    if ($facts['lsbdistcodename'] in $_transport_https_releases) and $location =~ /(?i:^https:\/\/)/ {
       ensure_packages('apt-transport-https')
     }
   }