(MODULES-7023) - Removing duplication in sync.yml
[puppet-modules/puppetlabs-apt.git] / manifests / conf.pp
index 49e32abaaa256254fd0d144d0bfc0eeed9187cef..b791f852190b4f5938774f1a4ae90db348a6ee39 100644 (file)
@@ -1,13 +1,22 @@
+# Defining apt config
 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,
 ) {
+
+  unless $ensure == 'absent' {
+    unless $content {
+      fail('Need to pass in content parameter')
+    }
+  }
+
+  $confheadertmp = epp('apt/_conf_header.epp')
   apt::setting { "conf-${name}":
-    ensure       => $ensure,
-    base_name    => $name,
-    setting_type => 'conf',
-    priority     => $priority,
-    content      => template('apt/_header.erb', 'apt/conf.erb'),
+    ensure        => $ensure,
+    priority      => $priority,
+    content       => "${confheadertmp}${content}",
+    notify_update => $notify_update,
   }
 }