Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Make restart-service more robust to avoid weird test flakiness" #824

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions components/datadog/agent/host_windowsos.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,8 @@ func (am *agentWindowsManager) getAgentConfigFolder() string {
func (am *agentWindowsManager) restartAgentServices(transform command.Transformer, opts ...pulumi.ResourceOption) (*remote.Command, error) {
// TODO: When we introduce Namer in components, we should use it here.
cmdName := am.host.Name() + "-" + "restart-agent"
// Retry restart several time, workaround to https://datadoghq.atlassian.net/browse/WINA-747
cmd := `
$tries = 0
$sleepTime = 1
while ($tries -lt 5) {
& "$($env:ProgramFiles)\Datadog\Datadog Agent\bin\agent.exe" restart-service 2>>stderr.txt
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) {
break
}
Start-Sleep -Seconds $sleepTime
$sleepTime = $sleepTime * 2
$tries++
}
Get-Content stderr.txt
Exit $exitCode
`

cmdArgs := command.Args{
Create: pulumi.String(cmd),
Create: pulumi.String(`Start-Process "$($env:ProgramFiles)\Datadog\Datadog Agent\bin\agent.exe" -Wait -ArgumentList restart-service`),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question
@iglendd should I use $($env:ProgramFiles)\Datadog\Datadog Agent\bin\agent.exe" restart-service without the Start-Process wrapper call?

}

// If a transform is provided, use it to modify the command name and args
Expand Down