]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
(#12529) Add parameter to support setting a proxy for apt
authorDan Bode <dan@puppetlabs.com>
Wed, 8 Feb 2012 17:40:43 +0000 (09:40 -0800)
committerDan Bode <dan@puppetlabs.com>
Wed, 8 Feb 2012 23:06:53 +0000 (15:06 -0800)
This commit adds two class parameter to apt that can be used to
specify a proxy to use with apt.

  - proxy_host
  - proxy_port

manifests/init.pp
manifests/source.pp

index 59a56e3f3252f0cf7cdbaf7ce7fa5a68659df271..8d266b8b17a8e8359b36e0c10bf816ad9203a60c 100644 (file)
@@ -16,7 +16,9 @@
 #  class { 'apt': }
 class apt(
   $disable_keys = false,
-  $always_apt_update = false
+  $always_apt_update = false,
+  $proxy_host = false,
+  $proxy_port = '8080'
 ) {
 
   include apt::params
@@ -54,4 +56,11 @@ class apt(
       creates => '/etc/apt/apt.conf.d/99unauth'
     }
   }
+
+  if($proxy_host) {
+    file { 'configure-apt-proxy':
+      path    => '/etc/apt/apt.conf.d/proxy',
+      content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
+    }
+  }
 }
index ddf753adf101d07cecdb79d8ecff5c72a5e37b6c..2bd2e42d5a0817973ecc1923eccfba7603b24024 100644 (file)
@@ -15,7 +15,6 @@ define apt::source(
 
   include apt::params
 
-
   file { "${name}.list":
     path => "${apt::params::root}/sources.list.d/${name}.list",
     ensure => file,
@@ -23,6 +22,7 @@ define apt::source(
     group => root,
     mode => 644,
     content => template("apt/source.list.erb"),
+
   }
 
   if $pin != false {