File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
1322class 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' :
Original file line number Diff line number Diff line change 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]' )
You can’t perform that action at this time.
0 commit comments