puppet: Fix puppet-apt bug with modern apt-key.

With modern apt-key, the fingerprints are displayed in the more fully
written-out format with spaces, and so `apt-key add` was being run
every time.

This fixes some unnecessary work being done on each puppet run on
Debian stretch.

I would have preferred to not need to do this by upgrading to
upstream, but see #7423 for notes on why that isn't going to work
(basically they broke support for puppet older than 4).
This commit is contained in:
Tim Abbott 2018-05-06 21:08:21 -07:00
parent 202063e030
commit eab1d1d9e7
1 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ define apt::key (
exec { $digest:
command => $digest_command,
path => '/bin:/usr/bin',
unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'",
unless => "/usr/bin/apt-key list | sed 's| ||g' | /bin/grep '${trimmedkey}'",
logoutput => 'on_failure',
before => Anchor["apt::key ${upkey} present"],
}
@ -76,7 +76,7 @@ define apt::key (
exec { "apt::key ${upkey} absent":
command => "apt-key del '${upkey}'",
path => '/bin:/usr/bin',
onlyif => "apt-key list | grep '${trimmedkey}'",
onlyif => "apt-key list | sed 's| ||g' | grep '${trimmedkey}'",
user => 'root',
group => 'root',
logoutput => 'on_failure',