3 Puppet::Type.newtype(:apt_key) do
6 This type provides Puppet with the capabilities to manage GPG keys needed
7 by apt to perform package validation. Apt has it's own GPG keyring that can
8 be manipulated through the `apt-key` command.
11 source => 'http://apt.puppetlabs.com/pubkey.gpg'
16 If Puppet is given the location of a key file which looks like an absolute
17 path this type will autorequire that file.
23 if self[:content] and self[:source]
24 fail('The properties content and source are mutually exclusive.')
28 newparam(:id, :namevar => true) do
29 desc 'The ID of the key you want to manage.'
30 # GPG key ID's should be either 32-bit (short) or 64-bit (long) key ID's
31 # and may start with the optional 0x
32 newvalues(/\A(0x)?[0-9a-fA-F]{8}\Z/, /\A(0x)?[0-9a-fA-F]{16}\Z/)
34 if value.start_with?('0x')
35 id = value.partition('0x').last.upcase
44 desc 'The content of, or string representing, a GPG key.'
48 desc 'Location of a GPG key file, /path/to/file, ftp://, http:// or https://'
49 newvalues(/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/)
53 if self[:source] and Pathname.new(self[:source]).absolute?
59 desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
60 defaultto :'keyserver.ubuntu.com'
62 newvalues(/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,4})?$/)
65 newparam(:keyserver_options) do
66 desc 'Additional options to pass to apt-key\'s --keyserver-options.'
69 newproperty(:expired) do
71 Indicates if the key has expired.
73 This property is read-only.
77 newproperty(:expiry) do
79 The date the key will expire, or nil if it has no expiry date.
81 This property is read-only.
87 The key size, usually a multiple of 1024.
89 This property is read-only.
95 The key type, either RSA or DSA.
97 This property is read-only.
101 newproperty(:created) do
103 Date the key was created.
105 This property is read-only.