From: Hunter Haugen Date: Mon, 1 Jul 2013 23:18:14 +0000 (-0700) Subject: Merge pull request #133 from benben/master X-Git-Tag: 1.1.1~4 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=142b72bbe21fcfa6bbd713f94c337ff3cda23b40;hp=18ee4cc6c9eb8d16becfec68254d8955eb10c7d5;p=puppet-modules%2Fpuppetlabs-apt.git Merge pull request #133 from benben/master trim keys to 8 chars for matching with apt-key list (fix for #100) --- diff --git a/manifests/key.pp b/manifests/key.pp index 98a0f3a..b14500e 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -9,6 +9,8 @@ define apt::key ( include apt::params $upkey = upcase($key) + # trim the key to the last 8 chars so we can match longer keys with apt-key list too + $trimmedkey = regsubst($upkey, '^.*(.{8})$', '\1') if $key_content { $method = 'content' @@ -48,7 +50,7 @@ define apt::key ( exec { $digest: command => $digest_command, path => '/bin:/usr/bin', - unless => "/usr/bin/apt-key list | /bin/grep '${upkey}'", + unless => "/usr/bin/apt-key list | /bin/grep '${trimmedkey}'", logoutput => 'on_failure', before => Anchor["apt::key ${upkey} present"], } @@ -66,7 +68,7 @@ define apt::key ( exec { "apt::key ${upkey} absent": command => "apt-key del '${upkey}'", path => '/bin:/usr/bin', - onlyif => "apt-key list | grep '${upkey}'", + onlyif => "apt-key list | grep '${trimmedkey}'", user => 'root', group => 'root', logoutput => 'on_failure',