Skip to content

Commit c3179b0

Browse files
authored
[apt] Only grep for last 8 characters as this is what apt-key list returns (DataDog#374)
* Only grep for last 8 characters as this is what apt-key list returns * [ubuntu] fix key substring extraction-interpolation [key] get last eight characters with regex subst
1 parent bcbf9a3 commit c3179b0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

manifests/ubuntu/install_key.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#
1414
#
1515
define datadog_agent::ubuntu::install_key() {
16+
$shortkey = regsubst($name, '.*(.{8})$', '\1')
17+
1618
exec { "key ${name}":
1719
command => "/usr/bin/apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${name}",
18-
unless => "/usr/bin/apt-key list | grep ${name} | grep expires",
20+
unless => "/usr/bin/apt-key list | grep ${shortkey} | grep expires",
1921
}
2022
}

0 commit comments

Comments
 (0)