module-puppetlabs-apt/lib
Chris Boot 42ab470d00 apt_key: fix parsing invalid dates when using GnuPG 2.x
If one should happen to have redirected /usr/bin/gpg to run GnuPG 2.x
rather than the more usual GnuPG 1.x, the apt_key provider fails with
the following error:

Could not prefetch apt_key provider 'apt_key': invalid date

This is because the output of "--with-colons" defaults to using
"fixed-list-mode" in 2.x but did not do so for 1.x. This new format
gives much more information about keys and also uses timestamps in
seconds from 1970-01-01 (UNIX epoch) rather than dates in the format
YYYY-MM-DD.

This patch adds "--fixed-list-mode" when calling apt-key, and adjusts
the code to parse the timestamps instead. This actually has several
advantages:

- Works the same with GnuPG 1.x and 2.x.
- More accurate expiry time tracking, not just entire days.
- No need to require 'date' any longer.
- Will allow the provider to expose more key information in future.

Tested on:
- Debian Wheezy (Puppet 2.7.23, Ruby 1.8.7p358)
- Debian Jessie (Puppet 3.7.2, Ruby 2.1.5p273)
2015-03-15 22:33:22 +00:00
..
facter Fix apt_has_updates fact not parsing apt-check output correctly 2015-01-16 17:45:55 -05:00
puppet apt_key: fix parsing invalid dates when using GnuPG 2.x 2015-03-15 22:33:22 +00:00
puppet_x/apt_key apt_key: Support fetching keys over FTP. 2014-02-21 09:06:47 +01:00