X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Finit.pp;h=e41cd3fdee7514b6373603d917638e3a77dbd28e;hb=0ffe484c7c5d64295f32eb34ce47c60eb823c66c;hp=068fb497c4933d3e9d7fb6af925c0a0ab459a581;hpb=51a7596b03fb0fb18a2dfaf54b011484b94f6308;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/init.pp b/manifests/init.pp index 068fb49..e41cd3f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,23 +29,21 @@ class apt( ) { include apt::params + include apt::update validate_bool($purge_sources_list, $purge_sources_list_d) - $refresh_only_apt_update = $always_apt_update? { - true => false, - false => true, - } - - if ! defined(Package['python-software-properties']) { - package { 'python-software-properties': } - } - $sources_list_content = $purge_sources_list ? { - false => undef, + false => undef, true => "# Repos managed by puppet.\n", } + if $always_apt_update == true { + Exec <| title=='apt_update' |> { + refreshonly => false, + } + } + $root = $apt::params::root $apt_conf_d = $apt::params::apt_conf_d $sources_list_d = $apt::params::sources_list_d @@ -58,6 +56,7 @@ class apt( group => root, mode => '0644', content => $sources_list_content, + notify => Exec['apt_update'], } file { 'sources.list.d': @@ -67,12 +66,7 @@ class apt( 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'] ], - refreshonly => $refresh_only_apt_update, + notify => Exec['apt_update'], } case $disable_keys { @@ -89,7 +83,7 @@ class apt( path => "${apt_conf_d}/99unauth", } } - undef: { } # do nothing + undef: { } # do nothing default: { fail('Valid values for disable_keys are true or false') } }