X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fsource.pp;h=c63fc2fb2282d5bd2dc457a256442683747b6b13;hb=effb3f7ff35675afd512f87c24bb81d2a712b983;hp=204639bdc5734547a5a7710f85af0a9d70c9cff8;hpb=644ed232a0c402b1020b697a10c612db68a9ffa4;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/source.pp b/manifests/source.pp index 204639b..c63fc2f 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -2,6 +2,7 @@ # add an apt source define apt::source( + $ensure = present, $location = '', $release = $lsbdistcodename, $repos = 'main', @@ -24,7 +25,7 @@ define apt::source( } file { "${name}.list": - ensure => file, + ensure => $ensure, path => "${sources_list_d}/${name}.list", owner => root, group => root, @@ -32,8 +33,11 @@ define apt::source( content => template("${module_name}/source.list.erb"), } - if $pin != false { - apt::pin { $release: priority => $pin } -> File["${name}.list"] + if ($pin != false) and ($ensure == 'present') { + apt::pin { $release: + priority => $pin, + before => File["${name}.list"] + } } exec { "${name} apt update": @@ -42,7 +46,7 @@ define apt::source( refreshonly => true, } - if $required_packages != false { + if ($required_packages != false) and ($ensure == 'present') { exec { "Required packages: '${required_packages}' for ${name}": command => "${provider} -y install ${required_packages}", subscribe => File["${name}.list"], @@ -50,7 +54,8 @@ define apt::source( } } - if $key != false { + # We do not want to remove keys when the source is absent. + if ($key != false) and ($ensure == 'present') { apt::key { "Add key: ${key} from Apt::Source ${title}": ensure => present, key => $key,