Skip to content

Commit

Permalink
Avoid exit immediately when ADOT Collector fails (#477)
Browse files Browse the repository at this point in the history
* Avoid exit immediately when Otel fails

* Add comment for why using return instead of exit
  • Loading branch information
khanhntd authored May 28, 2022
1 parent 89d1912 commit a029f69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packaging/windows/amazon-cloudwatch-agent-ctl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ Function CWOCConfig() {
Write-Output "Successfully fetched the config and saved in ${YAML_DIR}\default.tmp"
} else {
& cmd /c "`"$CWAProgramFiles\config-downloader.exe`" --output-dir ${YAML_DIR} --download-source ${OtelConfigLocation} --mode ${param_mode} --config ${COMMON_CONIG} --multi-config ${multi_config} 2>&1"
CheckCMDResult # Exit immediately if config-downloader outputs any error
# Use return instead of exit since CWAgent and ADOT Collector should be two independent agents as much as possible
if ($LASTEXITCODE -ne 0) {
return
}
}

$yamlDirContent = Get-ChildItem "${YAML_DIR}" | Measure-Object
Expand Down

0 comments on commit a029f69

Please sign in to comment.