|
17 | 17 | ) inherits datadog_agent::params { |
18 | 18 |
|
19 | 19 | $msi_full_path = "${msi_location}/datadog-agent-6-${agent_version}.amd64.msi" |
20 | | - $msi_source = "${baseurl}ddagent-cli-${agent_version}.msi" |
| 20 | + |
| 21 | + if $agent_version == 'latest' { |
| 22 | + $msi_source = "${baseurl}datadog-agent-6-latest.amd64.msi" |
| 23 | + } else { |
| 24 | + $msi_source = "${baseurl}ddagent-cli-${agent_version}.msi" |
| 25 | + } |
21 | 26 |
|
22 | 27 | if $ensure == 'present' { |
23 | 28 | if ($agent_version in ['6.14.0', '6.14.1']) { |
|
31 | 36 | } |
32 | 37 |
|
33 | 38 | exec { 'validate': |
34 | | - command => "\$blacklist = '928b00d2f952219732cda9ae0515351b15f9b9c1ea1d546738f9dc0fda70c336','78b2bb2b231bcc185eb73dd367bfb6cb8a5d45ba93a46a7890fd607dc9188194';\$fileStream = [system.io.file]::openread('${msi_full_path}'); \$hasher = [System.Security.Cryptography.HashAlgorithm]::create('sha256'); \$hash = \$hasher.ComputeHash(\$fileStream); \$fileStream.close(); \$fileStream.dispose();\$hexhash = [system.bitconverter]::tostring(\$hash).ToLower().replace('-','');if (\$hexhash -match \$blacklist) { Exit 1 }", |
| 39 | + command => "\$blacklist = '928b00d2f952219732cda9ae0515351b15f9b9c1ea1d546738f9dc0fda70c336','78b2bb2b231bcc185eb73dd367bfb6cb8a5d45ba93a46a7890fd607dc9188194';\$fileStream = [system.io.file]::openread('${msi_full_path}'); \$hasher = [System.Security.Cryptography.HashAlgorithm]::create('sha256'); \$hash = \$hasher.ComputeHash(\$fileStream); \$fileStream.close(); \$fileStream.dispose();\$hexhash = [system.bitconverter]::tostring(\$hash).ToLower().replace('-','');if (\$blacklist.Contains(\$hexhash)) { Exit 1 }", |
35 | 40 | provider => 'powershell', |
36 | 41 | logoutput => 'on_failure', |
37 | 42 | require => File['installer'], |
38 | 43 | notify => Package[$datadog_agent::params::package_name] |
39 | 44 | } |
40 | 45 |
|
| 46 | + if $agent_version == 'latest' { |
| 47 | + $ensure_version = 'installed' |
| 48 | + } else { |
| 49 | + $ensure_version = $agent_version |
| 50 | + } |
| 51 | + |
41 | 52 | package { $datadog_agent::params::package_name: |
42 | | - ensure => installed, |
| 53 | + ensure => $ensure_version, |
43 | 54 | provider => 'windows', |
44 | 55 | source => $msi_full_path, |
45 | 56 | install_options => ['/norestart', {'APIKEY' => $api_key, 'HOSTNAME' => $hostname, 'TAGS' => $tags}] |
|
0 commit comments