Skip to content

Commit a6637f8

Browse files
authored
Merge pull request #583 from DataDog/albertvaka/install-agent-6-windows
Windows install fixes
2 parents d7c6ac2 + 746c4b4 commit a6637f8

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

manifests/windows/agent6.pp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
) inherits datadog_agent::params {
1818

1919
$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+
}
2126

2227
if $ensure == 'present' {
2328
if ($agent_version in ['6.14.0', '6.14.1']) {
@@ -31,15 +36,21 @@
3136
}
3237

3338
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 }",
3540
provider => 'powershell',
3641
logoutput => 'on_failure',
3742
require => File['installer'],
3843
notify => Package[$datadog_agent::params::package_name]
3944
}
4045

46+
if $agent_version == 'latest' {
47+
$ensure_version = 'installed'
48+
} else {
49+
$ensure_version = $agent_version
50+
}
51+
4152
package { $datadog_agent::params::package_name:
42-
ensure => installed,
53+
ensure => $ensure_version,
4354
provider => 'windows',
4455
source => $msi_full_path,
4556
install_options => ['/norestart', {'APIKEY' => $api_key, 'HOSTNAME' => $hostname, 'TAGS' => $tags}]

0 commit comments

Comments
 (0)