- true => false,
- false => true
- }
-
- package { "python-software-properties": }
-
- file { "sources.list":
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- }
- name => "${apt::params::root}/sources.list",
-
- file { "sources.list.d":
- ensure => directory,
- owner => root,
- group => root,
- }
- name => "${apt::params::root}/sources.list.d",
-
- exec { "apt_update":
- command => "${apt::params::provider} update",
- subscribe => [ File["sources.list"], File["sources.list.d"] ],
+ true => false,
+ false => true,
+ }
+
+ if ! defined(Package['python-software-properties']) {
+ package { 'python-software-properties': }
+ }
+
+ $sources_list_content = $purge_sources_list ? {
+ false => undef,
+ true => "# Repos managed by puppet.\n",
+ }
+
+ $root = $apt::params::root
+ $apt_conf_d = $apt::params::apt_conf_d
+ $sources_list_d = $apt::params::sources_list_d
+ $provider = $apt::params::provider
+
+ file { 'sources.list':
+ ensure => present,
+ path => "${root}/sources.list",
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => $sources_list_content,
+ }
+
+ file { 'sources.list.d':
+ ensure => directory,
+ path => $sources_list_d,
+ owner => root,
+ group => root,
+ purge => $purge_sources_list_d,
+ recurse => $purge_sources_list_d,
+ }
+
+ exec { 'apt_update':
+ command => "${provider} update",
+ subscribe => [ File['sources.list'], File['sources.list.d'] ],