X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Finit.pp;h=581ce2d32db403b91eeda05a41a4db732a5e386d;hb=e9b2b123c7e06ec753f1bd49b91ca983957b66b9;hp=c89c2230cfd684c108acb924ca74868f345e8222;hpb=b637cdf66415ec206f94baf5dce2074a7fc10834;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/init.pp b/manifests/init.pp index c89c223..581ce2d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,10 +35,11 @@ class apt ( fail('This module only works on Debian or derivatives like Ubuntu') } - $frequency_options = ['always','daily','weekly','reluctantly'] - if $update['frequency'] { - validate_re($update['frequency'], $frequency_options) + assert_type( + Enum['always','daily','weekly','reluctantly'], + $update['frequency'], + ) } if $update['timeout'] { assert_type(Integer, $update['timeout']) @@ -66,7 +67,7 @@ class apt ( $_purge = merge($::apt::purge_defaults, $purge) if $proxy['ensure'] { - validate_re($proxy['ensure'], ['file', 'present', 'absent']) + assert_type(Enum['file', 'present', 'absent'], $proxy['ensure']) } if $proxy['host'] { assert_type(String, $proxy['host']) @@ -178,4 +179,19 @@ class apt ( if $pins { create_resources('apt::pin', $pins) } + + # required for adding GPG keys on Debian 9 (and derivatives) + case $facts['os']['name'] { + 'Debian': { + if versioncmp($facts['os']['release']['major'], '9') >= 0 { + ensure_packages(['dirmngr']) + } + } + 'Ubuntu': { + if versioncmp($facts['os']['release']['full'], '17.04') >= 0 { + ensure_packages(['dirmngr']) + } + } + default: { } + } }