X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=lib%2Fpuppet%2Ftype%2Fapt_key.rb;h=72f56fa1c3708a6afc927693a4a05d66f9bf65ef;hb=948a172a598ac1d15920c279eebf4811adc1dc4e;hp=c44aca092c654bf378e09b1972c43c73e757adc7;hpb=6c1fd8e819cc8ffb44ac187bb0fa7051d2958cc6;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/lib/puppet/type/apt_key.rb b/lib/puppet/type/apt_key.rb index c44aca0..72f56fa 100644 --- a/lib/puppet/type/apt_key.rb +++ b/lib/puppet/type/apt_key.rb @@ -1,10 +1,11 @@ require 'pathname' +require 'puppet/parameter/boolean' Puppet::Type.newtype(:apt_key) do @doc = <<-MANIFEST - This type provides Puppet with the capabilities to manage GPG keys needed - by apt to perform package validation. Apt has it's own GPG keyring that can - be manipulated through the `apt-key` command. + @summary This type provides Puppet with the capabilities to manage GPG keys needed + by apt to perform package validation. Apt has it's own GPG keyring that can + be manipulated through the `apt-key` command. @example Basic usage apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F': @@ -22,11 +23,14 @@ Puppet::Type.newtype(:apt_key) do ensurable validate do + if self[:refresh] == true && self[:ensure] == :absent + raise(_('ensure => absent and refresh => true are mutually exclusive')) + end if self[:content] && self[:source] - raise('The properties content and source are mutually exclusive.') + raise(_('The properties content and source are mutually exclusive.')) end if self[:id].length < 40 - warning('The id should be a full fingerprint (40 characters), see README.') + warning(_('The id should be a full fingerprint (40 characters), see README.')) end end @@ -71,6 +75,11 @@ Puppet::Type.newtype(:apt_key) do desc 'Additional options to pass to apt-key\'s --keyserver-options.' end + newparam(:refresh, boolean: true, parent: Puppet::Parameter::Boolean) do + desc 'When true, recreate an existing expired key' + defaultto false + end + newproperty(:fingerprint) do desc <<-MANIFEST The 40-digit hexadecimal fingerprint of the specified GPG key.