Merge pull request #732 from willmeek/release_4_4_1
[puppet-modules/puppetlabs-apt.git] / manifests / conf.pp
index 40f9c40307e41c26053bfae3053d2c91e629ed61..eea06861d9e3793e807a9e77d5388d0897941d3c 100644 (file)
@@ -1,14 +1,21 @@
 define apt::conf (
-  $content,
-  $ensure   = present,
-  $priority = '50'
+  Optional[String] $content          = undef,
+  Enum['present', 'absent'] $ensure  = present,
+  Variant[String, Integer] $priority = 50,
+  Optional[Boolean] $notify_update   = undef,
 ) {
 
-  file { "${$apt::conf_d}/${priority}${name}":
-    ensure  => $ensure,
-    content => template('apt/_header.erb', 'apt/conf.erb'),
-    owner   => root,
-    group   => root,
-    mode    => '0644',
+  unless $ensure == 'absent' {
+    unless $content {
+      fail('Need to pass in content parameter')
+    }
+  }
+
+  $confheadertmp = epp('apt/_conf_header.epp')
+  apt::setting { "conf-${name}":
+    ensure        => $ensure,
+    priority      => $priority,
+    content       => "${confheadertmp}${content}",
+    notify_update => $notify_update,
   }
 }