Skip to content

Commit 62a42a2

Browse files
committed
[puppet] legacy keys should still be installed - make it configurable.
1 parent 1a27e33 commit 62a42a2

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

manifests/ubuntu.pp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,31 @@
1010
#
1111
# Sample Usage:
1212
#
13+
#
14+
#
15+
define datadog_agent::ubuntu::install_key() {
16+
exec { "key ${name}":
17+
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",
19+
}
20+
}
21+
1322
class datadog_agent::ubuntu(
1423
$apt_key = '382E94DE',
15-
$agent_version = 'latest'
24+
$agent_version = 'latest',
25+
$other_keys = ['C7A7DA52']
1626
) {
1727

1828
ensure_packages(['apt-transport-https'])
29+
validate_array($other_keys)
1930

2031
if !$::datadog_agent::skip_apt_key_trusting {
21-
exec { 'datadog_key':
22-
command => "/usr/bin/apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ${apt_key}",
23-
unless => "/usr/bin/apt-key list | grep ${apt_key} | grep expires",
32+
$mykeys = concat($other_keys, [$apt_key])
33+
34+
::datadog_agent::ubuntu::install_key { $mykeys:
2435
before => File['/etc/apt/sources.list.d/datadog.list'],
2536
}
37+
2638
}
2739

2840
file { '/etc/apt/sources.list.d/datadog.list':

spec/classes/datadog_agent_ubuntu_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
end
1515

1616
# it should install the mirror
17-
it { should contain_exec('datadog_key') }
17+
it { should contain_datadog_agent__ubuntu__install_key('C7A7DA52') }
18+
it { should contain_datadog_agent__ubuntu__install_key('382E94DE') }
1819
it do
1920
should contain_file('/etc/apt/sources.list.d/datadog.list')\
2021
.that_notifies('Exec[datadog_apt-get_update]')

0 commit comments

Comments
 (0)