Fix use of $::apt::params::backports and $::apt::params::xfacts.
[puppet-modules/puppetlabs-apt.git] / manifests / init.pp
index dbf03329586177846ddf5c0bdad09663eefff347..48c4f53050e8c8baaac5e3a86c307fbc0a38dc36 100644 (file)
@@ -14,9 +14,6 @@ class apt(
   if $update['frequency'] {
     validate_re($update['frequency'], $frequency_options)
   }
-  if $update['always'] {
-    validate_bool($update['always'])
-  }
   if $update['timeout'] {
     unless is_integer($update['timeout']) {
       fail('timeout value for update must be an integer')
@@ -70,21 +67,21 @@ class apt(
   if $proxy['host'] {
     apt::setting { 'conf-proxy':
       priority => '01',
-      content  => template('apt/_header.erb', 'apt/proxy.erb'),
+      content  => template('apt/_conf_header.erb', 'apt/proxy.erb'),
     }
   }
 
   $sources_list_content = $_purge['sources.list'] ? {
-    false => undef,
-    true  => "# Repos managed by puppet.\n",
+    true    => "# Repos managed by puppet.\n",
+    default => undef,
   }
 
   $preferences_ensure = $_purge['preferences'] ? {
-    false => file,
-    true  => absent,
+    true    => absent,
+    default => file,
   }
 
-  if $_update['always'] {
+  if $_update['frequency'] == 'always' {
     Exec <| title=='apt_update' |> {
       refreshonly => false,
     }
@@ -92,7 +89,7 @@ class apt(
 
   apt::setting { 'conf-update-stamp':
     priority => 15,
-    content  => template('apt/_header.erb', 'apt/15update-stamp.erb'),
+    content  => template('apt/_conf_header.erb', 'apt/15update-stamp.erb'),
   }
 
   file { 'sources.list':
@@ -136,10 +133,7 @@ class apt(
     notify  => Exec['apt_update'],
   }
 
-  # Need anchor to provide containment for dependencies.
-  anchor { 'apt::update':
-    require => Class['apt::update'],
-  }
+  anchor { 'apt_first': } -> Class['apt::update'] -> anchor { 'apt_last': }
 
   # manage sources if present
   if $sources {