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
48 desc 'The content of, or string representing, a GPG key.'
52 desc 'Location of a GPG key file, /path/to/file, http:// or https://'
53 newvalues(/\Ahttps?:\/\//, /\A\/\w+/)
57 if self[:source] and Pathname.new(self[:source]).absolute?
63 desc 'The key server to fetch the key from based on the ID.'
64 defaultto :'keyserver.ubuntu.com'
65 # Need to validate this, preferably through stdlib is_fqdn
66 # but still working on getting to that.
69 newparam(:keyserver_options) do
70 desc 'Additional options to pass to apt-key\'s --keyserver-options.'
73 newproperty(:expired) do
75 Indicates if the key has expired.
77 This property is read-only.
81 newproperty(:expiry) do
83 The date the key will expire, or nil if it has no expiry date.
85 This property is read-only.
91 The key size, usually a multiple of 1024.
93 This property is read-only.
99 The key type, either RSA or DSA.
101 This property is read-only.
105 newproperty(:created) do
107 Date the key was created.
109 This property is read-only.