Skip to content

Commit e1cb79a

Browse files
truthbkalbertvaka
andcommitted
addressing cops
Apply suggestions from code review Co-Authored-By: Albert Vaca <albert.vaca@datadoghq.com>
1 parent 93e1e7e commit e1cb79a

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
}
6666
'Windows': {
6767
$agent5_default_repo = '<agent 5 is not supported by this module on windows>' # Param in init.pp so needs to be defined, but not used on Windows
68-
$agent6_default_repo = "https://s3.amazonaws.com/ddagent-windows-stable/"
68+
$agent6_default_repo = 'https://s3.amazonaws.com/ddagent-windows-stable/'
6969
$conf5_dir = 'C:/ProgramData/Datadog/agent5' # Not a real path, but integrations use it to ensure => absent so it needs to be a valid path
7070
$conf6_dir = 'C:/ProgramData/Datadog/conf.d'
7171
$dd_user = 'ddagentuser'

manifests/windows/agent6.pp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@
2121

2222
if $ensure == 'present' {
2323
if ($agent_version in ['6.14.0', '6.14.1']) {
24-
fail("The specified agent version has been blacklisted, please specify a version other than 6.14.0 or 6.14.1")
24+
fail('The specified agent version has been blacklisted, please specify a version other than 6.14.0 or 6.14.1')
2525
}
2626

2727
file { 'installer':
28-
path => $msi_full_path,
29-
source => "${msi_source}",
28+
path => $msi_full_path,
29+
source => $msi_source,
3030
provider => 'windows',
3131
}
3232

3333
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 }",
35-
provider => 'powershell',
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 }",
35+
provider => 'powershell',
3636
logoutput => 'on_failure',
37-
notify => Package[$datadog_agent::params::package_name]
37+
require => File['installer'],
38+
notify => Package[$datadog_agent::params::package_name]
3839
}
3940

4041
package { $datadog_agent::params::package_name:
@@ -51,7 +52,7 @@
5152
}
5253
} else {
5354
exec { 'datadog_6_14_fix':
54-
command => "((New-Object System.Net.WebClient).DownloadFile('https://s3.amazonaws.com/ddagent-windows-stable/scripts/fix_6_14.ps1', \$env:temp + '\\fix_6_14.ps1')); &\$env:temp\\fix_6_14.ps1",
55+
command => "((New-Object System.Net.WebClient).DownloadFile('https://s3.amazonaws.com/ddagent-windows-stable/scripts/fix_6_14.ps1', \$env:temp + '\\fix_6_14.ps1')); &\$env:temp\\fix_6_14.ps1",
5556
provider => 'powershell',
5657
}
5758

0 commit comments

Comments
 (0)