(FM-7316) - i18n Process implemented and .pot file generated
[puppet-modules/puppetlabs-apt.git] / manifests / source.pp
index 7ce759794b1e758149c180b04a48708ca5c7cbbc..981933d0c21ce4d7b1b8664fa5f47b75d038c79f 100644 (file)
@@ -14,7 +14,6 @@ define apt::source(
   Boolean $notify_update                        = true,
 ) {
 
-  # This is needed for compat with 1.8.x
   include ::apt
 
   $_before = Apt::Setting["list-${title}"]
@@ -23,23 +22,20 @@ define apt::source(
     if $facts['lsbdistcodename'] {
       $_release = $facts['lsbdistcodename']
     } else {
-      fail('lsbdistcodename fact not available: release parameter required')
+      fail(translate('lsbdistcodename fact not available: release parameter required'))
     }
   } else {
     $_release = $release
   }
 
-  # Some releases do not support https transport with default installation
-  $_transport_https_releases = [ 'jessie', 'stretch', 'trusty', 'xenial' ]
-
   if $ensure == 'present' {
     if ! $location {
-      fail('cannot create a source entry without specifying a location')
-    } elsif $_release in $_transport_https_releases {
-      $method = split($location, '[:\/]+')[0]
-      if $method == 'https' {
-        ensure_packages('apt-transport-https')
-      }
+      fail(translate('cannot create a source entry without specifying a location'))
+    }
+    # Newer oses, do not need the package for HTTPS transport.
+    $_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ]
+    if $_release in $_transport_https_releases and $location =~ /(?i:^https:\/\/)/ {
+      ensure_packages('apt-transport-https')
     }
   }
 
@@ -48,7 +44,7 @@ define apt::source(
   if $key {
     if $key =~ Hash {
       unless $key['id'] {
-        fail('key hash must contain at least an id entry')
+        fail(translate('key hash must contain at least an id entry'))
       }
       $_key = merge($::apt::source_key_defaults, $key)
     } else {
@@ -87,7 +83,7 @@ define apt::source(
         'origin'   => $host,
       }
     } else {
-      fail('Received invalid value for pin parameter')
+      fail(translate('Received invalid value for pin parameter'))
     }
     create_resources('apt::pin', { "${name}" => $_pin })
   }