(FM-7316) - i18n Process implemented and .pot file generated
[puppet-modules/puppetlabs-apt.git] / manifests / backports.pp
index f7e85f59ed9744fdaaaa8ce7b46d9b788e23ce60..8555cb0f7a2c68455fbab71b18ee122f5a14bc67 100644 (file)
@@ -1,34 +1,29 @@
+# Defining backports for the apt class
 class apt::backports (
-  $location = undef,
-  $release  = undef,
-  $repos    = undef,
-  $key      = undef,
-  $pin      = 200,
+  Optional[String] $location                    = undef,
+  Optional[String] $release                     = undef,
+  Optional[String] $repos                       = undef,
+  Optional[Variant[String, Hash]] $key          = undef,
+  Optional[Variant[Integer, String, Hash]] $pin = 200,
 ){
   if $location {
-    validate_string($location)
     $_location = $location
   }
   if $release {
-    validate_string($release)
     $_release = $release
   }
   if $repos {
-    validate_string($repos)
     $_repos = $repos
   }
   if $key {
-    unless is_hash($key) {
-      validate_string($key)
-    }
     $_key = $key
   }
-  if ($::apt::xfacts['lsbdistid'] == 'debian' or $::apt::xfacts['lsbdistid'] == 'ubuntu') {
+  if ($facts['lsbdistid'] == 'Debian' or $facts['lsbdistid'] == 'Ubuntu') {
     unless $location {
       $_location = $::apt::backports['location']
     }
     unless $release {
-      $_release = "${::apt::xfacts['lsbdistcodename']}-backports"
+      $_release = "${facts['lsbdistcodename']}-backports"
     }
     unless $repos {
       $_repos = $::apt::backports['repos']
@@ -38,13 +33,13 @@ class apt::backports (
     }
   } else {
     unless $location and $release and $repos and $key {
-      fail('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key')
+      fail(translate('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key'))
     }
   }
 
-  if is_hash($pin) {
+  if $pin =~ Hash {
     $_pin = $pin
-  } elsif is_numeric($pin) or is_string($pin) {
+  } elsif $pin =~ Numeric or $pin =~ String {
     # apt::source defaults to pinning to origin, but we should pin to release
     # for backports
     $_pin = {
@@ -52,7 +47,7 @@ class apt::backports (
       'release'  => $_release,
     }
   } else {
-    fail('pin must be either a string, number or hash')
+    fail(translate('pin must be either a string, number or hash'))
   }
 
   apt::source { 'backports':