]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Adding proxy support
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Jan 2010 13:08:33 +0000 (11:08 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Jan 2010 13:08:33 +0000 (11:08 -0200)
manifests/init.pp
templates/proxy.erb [new file with mode: 0644]

index 7d521352bd9da2b7c4ac1f56234dae5154b2782f..dcd4b2091b628bbfd37f2f324a5200d9422746f6 100644 (file)
@@ -21,6 +21,16 @@ class apt {
     default => $apt_update_method,
   }
 
+  $apt_http_proxy = $apt_http_proxy ? {
+    ''      => false,
+    default => $apt_http_proxy,
+  }
+
+  $apt_ftp_proxy = $apt_ftp_proxy ? {
+    ''      => false,
+    default => $apt_ftp_proxy,
+  }
+
        package { apt: ensure => installed }
 
        # a few templates need lsbdistcodename
@@ -229,6 +239,20 @@ class apt {
             }
           }
         }
+
+       if $apt_http_proxy or $apt_ftp_proxy {
+         file { "/etc/apt/apt.conf.d/proxy":
+           owner   => root,
+           group   => root,
+           mode    => 0644,
+           content => template("apt/proxy.erb"),
+                require => File[apt_config],
+         }
+       } else {
+         file { "/etc/apt/apt.conf.d/proxy":
+           ensure => absent,
+         }
+       }
 }       
 
 class dselect {
diff --git a/templates/proxy.erb b/templates/proxy.erb
new file mode 100644 (file)
index 0000000..01c9861
--- /dev/null
@@ -0,0 +1,4 @@
+Acquire {
+<% if apt_http_proxy != false %>  HTTP::Proxy "<%= apt_http_proxy %>";<% end %>
+<% if apt_ftp_proxy  != false %>  FTP::Proxy  "<%= apt_ftp_proxy %>";<% end %>
+};