Merge pull request #149 from bionix/add_wheezy_backports
[puppet-modules/puppetlabs-apt.git] / manifests / ppa.pp
index f234f748e7c6921fd16687669ee13f5cc6ee45d1..92b6c0e0b28e131af31b3d0903d6de1882aca896 100644 (file)
@@ -1,7 +1,8 @@
 # ppa.pp
 
 define apt::ppa(
-  $release = $::lsbdistcodename
+  $release = $::lsbdistcodename,
+  $options = "-y"
 ) {
   include apt::params
   include apt::update
@@ -12,9 +13,9 @@ define apt::ppa(
     fail('lsbdistcodename fact not available: release parameter required')
   }
 
-  $filename_without_slashes = regsubst($name, '/', '-', G)
-  $filename_without_dots    = regsubst($filename_without_slashes, '\.', '_', G)
-  $filename_without_ppa     = regsubst($filename_without_dots, '^ppa:', '', G)
+  $filename_without_slashes = regsubst($name, '/', '-', 'G')
+  $filename_without_dots    = regsubst($filename_without_slashes, '\.', '_', 'G')
+  $filename_without_ppa     = regsubst($filename_without_dots, '^ppa:', '', 'G')
   $sources_list_d_filename  = "${filename_without_ppa}-${release}.list"
 
   $package = $::lsbdistrelease ? {
@@ -30,17 +31,17 @@ define apt::ppa(
     $proxy_host = getparam(Class[apt], "proxy_host")
     $proxy_port = getparam(Class[apt], "proxy_port")
     case  $proxy_host {
-      false: {
-        $proxy_env = ""
+      false, "": {
+        $proxy_env = []
       }
       default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]}
     }
   } else {
-    $proxy_env = ""
+    $proxy_env = []
   }
   exec { "add-apt-repository-${name}":
     environment  => $proxy_env,
-    command   => "/usr/bin/add-apt-repository ${name}",
+    command   => "/usr/bin/add-apt-repository ${options} ${name}",
     creates   => "${sources_list_d}/${sources_list_d_filename}",
     logoutput => 'on_failure',
     require   => [