- if ($proxy_host) {
- file { 'configure-apt-proxy':
- path => "${apt_conf_d}/proxy",
- content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
- notify => Exec['apt_update'],
- }
+ $proxy_set = $proxy_host ? {
+ undef => absent,
+ default => present
+ }
+
+ file { '01proxy':
+ ensure => $proxy_set,
+ path => "${apt_conf_d}/01proxy",
+ content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n",
+ notify => Exec['apt_update'],
+ mode => '0644',
+ owner => root,
+ group => root,
+ }
+
+ file { 'old-proxy-file':
+ ensure => absent,
+ path => "${apt_conf_d}/proxy",
+ notify => Exec['apt_update'],
+ }
+
+ # Need anchor to provide containment for dependencies.
+ anchor { 'apt::update':
+ require => Class['apt::update'],
+ }
+
+ # manage sources if present
+ if $sources != undef {
+ validate_hash($sources)
+ create_resources('apt::source', $sources)