Merge pull request #964 from kenyon/use-modern-os-facts
[puppet-modules/puppetlabs-apt.git] / manifests / source.pp
index 365ba13dedc69382dc317772285638f075a6f745..2c3d4b84cb0e718020820be8c508b69865d98672 100644 (file)
@@ -27,7 +27,7 @@
 #
 # @param include
 #   Configures include options. Valid options: a hash of available keys.
-# 
+#
 # @option include [Boolean] :deb
 #   Specifies whether to request the distribution's compiled binaries. Default true.
 #
 #   Specifies whether to request the distribution's uncompiled source code. Default false.
 #
 # @param key
-#   Creates a declaration of the apt::key defined type. Valid options: a string to be passed to the `id` parameter of the `apt::key` 
-#   defined type, or a hash of `parameter => value` pairs to be passed to `apt::key`'s `id`, `server`, `content`, `source`, and/or 
+#   Creates a declaration of the apt::key defined type. Valid options: a string to be passed to the `id` parameter of the `apt::key`
+#   defined type, or a hash of `parameter => value` pairs to be passed to `apt::key`'s `id`, `server`, `content`, `source`, and/or
 #   `options` parameters.
 #
 # @param pin
-#   Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the 
+#   Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the
 #   `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters.
 #
 # @param architecture
-#   Tells Apt to only download information for specified architectures. Valid options: a string containing one or more architecture names, 
-#   separated by commas (e.g., 'i386' or 'i386,alpha,powerpc'). Default: undef (if unspecified, Apt downloads information for all architectures 
+#   Tells Apt to only download information for specified architectures. Valid options: a string containing one or more architecture names,
+#   separated by commas (e.g., 'i386' or 'i386,alpha,powerpc'). Default: undef (if unspecified, Apt downloads information for all architectures
 #   defined in the Apt::Architectures option).
 #
 # @param allow_unsigned
@@ -73,10 +73,10 @@ define apt::source(
   $_before = Apt::Setting["list-${title}"]
 
   if !$release {
-    if $facts['lsbdistcodename'] {
-      $_release = $facts['lsbdistcodename']
+    if $facts['os']['distro']['codename'] {
+      $_release = $facts['os']['distro']['codename']
     } else {
-      fail(translate('lsbdistcodename fact not available: release parameter required'))
+      fail(translate('os.distro.codename fact not available: release parameter required'))
     }
   } else {
     $_release = $release
@@ -94,7 +94,7 @@ define apt::source(
     }
     # Newer oses, do not need the package for HTTPS transport.
     $_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ]
-    if ($facts['lsbdistcodename'] in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
+    if ($facts['os']['distro']['codename'] in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
       ensure_packages('apt-transport-https')
     }
   } else {