]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
proxy support for apt::ppa
authorPierre Gambarotto <pierre.gambarotto@n7.fr>
Thu, 11 Jul 2013 13:29:38 +0000 (15:29 +0200)
committerPierre Gambarotto <pierre.gambarotto@n7.fr>
Thu, 11 Jul 2013 13:29:38 +0000 (15:29 +0200)
manifests/ppa.pp

index 725170d2dc39dfb9c8b51841b795a8d467cb480c..f234f748e7c6921fd16687669ee13f5cc6ee45d1 100644 (file)
@@ -26,7 +26,20 @@ define apt::ppa(
     package { $package: }
   }
 
+  if defined(Class[apt]) {
+    $proxy_host = getparam(Class[apt], "proxy_host")
+    $proxy_port = getparam(Class[apt], "proxy_port")
+    case  $proxy_host {
+      false: {
+        $proxy_env = ""
+      }
+      default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]}
+    }
+  } else {
+    $proxy_env = ""
+  }
   exec { "add-apt-repository-${name}":
+    environment  => $proxy_env,
     command   => "/usr/bin/add-apt-repository ${name}",
     creates   => "${sources_list_d}/${sources_list_d_filename}",
     logoutput => 'on_failure',