X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Finit.pp;h=140e171c50b008cb8f57d8596cfe77ca8f958476;hb=911c4de90fc493e4449d42a1ed6ea0e40925b330;hp=ea546dc55ef8badde4921cf4b5a77715d8571186;hpb=fe228435b1c9219b7fe61e6faafe810b117fd5e4;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/init.pp b/manifests/init.pp index ea546dc..140e171 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,20 +1,19 @@ # class apt( - $update = {}, - $purge = {}, - $proxy = {}, - $sources = undef, + $update = {}, + $purge = {}, + $proxy = {}, + $sources = {}, + $keys = {}, + $ppas = {}, + $settings = {}, ) inherits ::apt::params { - $frequency_options = ['always','daily','weekly','reluctantly'] validate_hash($update) if $update['frequency'] { validate_re($update['frequency'], $frequency_options) } - if $update['always'] { - validate_bool($update['always']) - } if $update['timeout'] { unless is_integer($update['timeout']) { fail('timeout value for update must be an integer') @@ -60,6 +59,11 @@ class apt( $_proxy = merge($apt::proxy_defaults, $proxy) + validate_hash($sources) + validate_hash($keys) + validate_hash($settings) + validate_hash($ppas) + if $proxy['host'] { apt::setting { 'conf-proxy': priority => '01', @@ -77,7 +81,7 @@ class apt( true => absent, } - if $_update['always'] { + if $_update['frequency'] == 'always' { Exec <| title=='apt_update' |> { refreshonly => false, } @@ -129,14 +133,22 @@ class apt( notify => Exec['apt_update'], } - # Need anchor to provide containment for dependencies. - anchor { 'apt::update': - require => Class['apt::update'], - } + contain 'apt::update' # manage sources if present - if $sources != undef { - validate_hash($sources) + if $sources { create_resources('apt::source', $sources) } + # manage keys if present + if $keys { + create_resources('apt::key', $keys) + } + # manage ppas if present + if $ppas { + create_resources('apt::ppa', $ppas) + } + # manage settings if present + if $settings { + create_resources('apt::setting', $settings) + } }