Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge pull request #122 from strangeman/master
[puppet-modules/puppetlabs-apt.git]
/
manifests
/
key.pp
diff --git
a/manifests/key.pp
b/manifests/key.pp
index a6ebf7bd37ef0273ea9f70ec0d1c64815e7ba6b1..c78bf658ce984a538aad7552ca3dd98581b3f29c 100644
(file)
--- a/
manifests/key.pp
+++ b/
manifests/key.pp
@@
-10,6
+10,8
@@
define apt::key (
include apt::params
$upkey = upcase($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'
if $key_content {
$method = 'content'
@@
-56,7
+58,7
@@
define apt::key (
exec { $digest:
command => $digest_command,
path => '/bin:/usr/bin',
exec { $digest:
command => $digest_command,
path => '/bin:/usr/bin',
- unless => "/usr/bin/apt-key list | /bin/grep '${
up
key}'",
+ unless => "/usr/bin/apt-key list | /bin/grep '${
trimmed
key}'",
logoutput => 'on_failure',
before => Anchor["apt::key ${upkey} present"],
}
logoutput => 'on_failure',
before => Anchor["apt::key ${upkey} present"],
}
@@
-74,7
+76,7
@@
define apt::key (
exec { "apt::key ${upkey} absent":
command => "apt-key del '${upkey}'",
path => '/bin:/usr/bin',
exec { "apt::key ${upkey} absent":
command => "apt-key del '${upkey}'",
path => '/bin:/usr/bin',
- onlyif => "apt-key list | grep '${
up
key}'",
+ onlyif => "apt-key list | grep '${
trimmed
key}'",
user => 'root',
group => 'root',
logoutput => 'on_failure',
user => 'root',
group => 'root',
logoutput => 'on_failure',