Skip to content

Commit 45bb750

Browse files
fix(infra-windows): quiet noisy install output for cleaner UX (#1374)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent db128b2 commit 45bb750

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

recipes/newrelic/infrastructure/windows.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,9 @@ install:
257257
Add-Content -Path $Path -Value "proxy: $env:HTTPS_PROXY" -Encoding utf8
258258
}
259259
Add-Content -Path $Path -Value $CustomAttrs -Encoding utf8
260-
Write-Host "Configuration written successfully"
261260
}
262261
263262
if ($existingService) {
264-
Write-Host "Existing service detected, performing upgrade..."
265-
266263
# Write fresh config before calling installer.ps1 — in upgrade mode
267264
# installer.ps1 preserves the existing config, so this ensures the service
268265
# starts with valid settings (including license_key) on the first start.
@@ -285,7 +282,6 @@ install:
285282
Write-Host -ForegroundColor Red "installer.ps1 not found in extracted MSI"
286283
exit 1
287284
}
288-
Write-Host "Found installer.ps1 at: $($installerScript.FullName)"
289285
290286
$scriptDir = $installerScript.DirectoryName
291287
Push-Location $scriptDir
@@ -303,7 +299,6 @@ install:
303299
Pop-Location
304300
}
305301
} else {
306-
Write-Host "No existing service detected, performing fresh install..."
307302
$process = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i `"$MSI_PATH`" GENERATE_CONFIG=true LICENSE_KEY=`"$LICENSE_KEY`" /L*v `"$env:TEMP\\msi_install.log`"" -Wait -NoNewWindow -PassThru
308303
if ($process.ExitCode -ne 0) {
309304
Write-Host -ForegroundColor Red "MSI installation failed with exit code: $($process.ExitCode)"
@@ -317,7 +312,7 @@ install:
317312
# MSI starts the service with a yamlgen-generated config (license_key only).
318313
# Rewrite config fresh and restart so all required settings take effect.
319314
Write-FreshConfig -Path $InfraConfig -LicenseKey $LICENSE_KEY -Region $NEW_RELIC_REGION -CustomAttrs $customAttributes
320-
Restart-Service -Name "newrelic-infra" -Force -ErrorAction SilentlyContinue
315+
Restart-Service -Name "newrelic-infra" -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
321316
}
322317
'
323318
@@ -333,14 +328,13 @@ install:
333328
if ($service.Status -ne "Running") {
334329
try {
335330
Start-Service -Name $serviceName
336-
Write-Host "New Relic infrastructure agent for Windows installed and started" -ForegroundColor Green
337331
}
338332
catch {
339333
Write-Host "Error starting service: $_" -ForegroundColor Red
340334
}
341335
}
342-
else {
343-
Write-Host "$serviceName is already running" -ForegroundColor Green
336+
if ((Get-Service $serviceName -ErrorAction SilentlyContinue).Status -eq "Running") {
337+
Write-Host "New Relic Infrastructure Agent is running" -ForegroundColor Green
344338
}
345339
'
346340

test/definitions-eu/apm/dotNet/windows/iis-blank.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"type": "ec2",
1313
"size": "t3.small",
1414
"is_windows": true,
15-
"ami_name": "Windows_Server-2019-English-Full-HyperV-*",
15+
"ami_name": "Windows_Server-2019-English-Full-Base-*",
1616
"user_name": "Administrator"
1717
}],
1818

0 commit comments

Comments
 (0)