Browse Source

(#12529) Add parameter to support setting a proxy for apt

This commit adds two class parameter to apt that can be used to
specify a proxy to use with apt.

  - proxy_host
  - proxy_port
Dan Bode 12 years ago
parent
commit
50f3cca
2 changed files with 11 additions and 2 deletions
  1. 10 1
      manifests/init.pp
  2. 1 1
      manifests/source.pp

+ 10 - 1
manifests/init.pp

@@ -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}\";",
+    }
+  }
 }

+ 1 - 1
manifests/source.pp

@@ -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 {