This work flips from onlyif to unless (mistakenly looked at the
[puppet-modules/puppetlabs-apt.git] / manifests / init.pp
index b8e356c53ae8a3aa09b7427a96065189b1389158..b106ad490979ce67522382eb02f54a9ce7a1a15d 100644 (file)
@@ -12,6 +12,8 @@
 #     true, Puppet will purge all unmanaged entries from sources.list
 #   purge_sources_list_d - Accepts true or false. Defaults to false. If set
 #     to true, Puppet will purge all unmanaged entries from sources.list.d
+#   update_timeout - Overrides the exec timeout in seconds for apt-get update.
+#     If not set defaults to Exec's default (300)
 #
 # Actions:
 #
@@ -27,7 +29,8 @@ class apt(
   $proxy_port           = '8080',
   $purge_sources_list   = false,
   $purge_sources_list_d = false,
-  $purge_preferences_d  = false
+  $purge_preferences_d  = false,
+  $update_timeout       = undef
 ) {
 
   include apt::params
@@ -99,12 +102,16 @@ class apt(
     default: { fail('Valid values for disable_keys are true or false') }
   }
 
-  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 ? {
+    false   => absent,
+    default => present
+  }
+
+  file { 'configure-apt-proxy':
+    ensure  => $proxy_set,
+    path    => "${apt_conf_d}/proxy",
+    content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";",
+    notify  => Exec['apt_update'],
   }
 
   # Need anchor to provide containment for dependencies.