Corrected regression with preference files name
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
index 33cd60d586c1b7d42e9357edca8f7904abf07d13..6352352c8d54711baeffecb0871c0dfa17bfc4eb 100644 (file)
@@ -1,17 +1,17 @@
 # ppa.pp
 define apt::ppa(
   $ensure         = 'present',
-  $release        = $::lsbdistcodename,
   $options        = $::apt::ppa_options,
+  $release        = $::apt::xfacts['lsbdistcodename'],
   $package_name   = $::apt::ppa_package,
   $package_manage = false,
 ) {
-  if ! $release {
+  unless $release {
     fail('lsbdistcodename fact not available: release parameter required')
   }
 
-  if $::apt::distid != 'ubuntu' {
-    fail('apt::ppa is currently supported on Ubuntu and LinuxMint only.')
+  if $::apt::xfacts['lsbdistid'] == 'Debian' {
+    fail('apt::ppa is not currently supported on Debian.')
   }
 
   $filename_without_slashes = regsubst($name, '/', '-', 'G')
@@ -31,9 +31,9 @@ define apt::ppa(
     $_proxy = $::apt::_proxy
     if $_proxy['host'] {
       if $_proxy['https'] {
-        $_proxy_env = ["http_proxy=http://${_proxy['host']}:${_proxy['port']}", "https_proxy=https://${_proxy['host']}:${_proxy['port']}"]
+        $_proxy_env = ["http_proxy=http://${$_proxy['host']}:${$_proxy['port']}", "https_proxy=https://${$_proxy['host']}:${$_proxy['port']}"]
       } else {
-        $_proxy_env = ["http_proxy=http://${_proxy['host']}:${_proxy['port']}"]
+        $_proxy_env = ["http_proxy=http://${$_proxy['host']}:${$_proxy['port']}"]
       }
     } else {
       $_proxy_env = []
@@ -45,7 +45,7 @@ define apt::ppa(
       unless      => "/usr/bin/test -s ${::apt::sources_list_d}/${sources_list_d_filename}",
       user        => 'root',
       logoutput   => 'on_failure',
-      notify      => Exec['apt_update'],
+      notify      => Class['apt::update'],
       require     => $_require,
     }
 
@@ -57,12 +57,7 @@ define apt::ppa(
   else {
     file { "${::apt::sources_list_d}/${sources_list_d_filename}":
       ensure => 'absent',
-      notify => Exec['apt_update'],
+      notify => Class['apt::update'],
     }
   }
-
-  # Need anchor to provide containment for dependencies.
-  anchor { "apt::ppa::${name}":
-    require => Class['apt::update'],
-  }
 }