Merge pull request #904 from anarcat/sources-list-remove
authorcarabasdaniel <daniel.carabas@puppet.com>
Thu, 13 Feb 2020 07:52:25 +0000 (09:52 +0200)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 07:52:25 +0000 (09:52 +0200)
MODULES-10543: remove sources.list file on purging

manifests/init.pp

index b21ce1266510946cac255e6a3a5fa8fd1abe0dea..39955344007233af8a1117b89fb54621fdfd7752 100644 (file)
@@ -204,9 +204,9 @@ class apt (
     }
   }
 
-  $sources_list_content = $_purge['sources.list'] ? {
-    true    => "# Repos managed by puppet.\n",
-    default => undef,
+  $sources_list_ensure = $_purge['sources.list'] ? {
+    true    => absent,
+    default => file,
   }
 
   $preferences_ensure = $_purge['preferences'] ? {
@@ -226,13 +226,12 @@ class apt (
   }
 
   file { 'sources.list':
-    ensure  => file,
-    path    => $::apt::sources_list,
-    owner   => root,
-    group   => root,
-    mode    => '0644',
-    content => $sources_list_content,
-    notify  => Class['apt::update'],
+    ensure => $sources_list_ensure,
+    path   => $::apt::sources_list,
+    owner  => root,
+    group  => root,
+    mode   => '0644',
+    notify => Class['apt::update'],
   }
 
   file { 'sources.list.d':