Skip to content

Commit

Permalink
fix(mssql): Fix sqlcmd credential override (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
rthorn-nr authored May 31, 2023
1 parent 2f07ff4 commit f2b638a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ install:
if (Test-Path $NriSqlFile) { Remove-Item $NriSqlFile }
Add-Content -Path $NriSqlFile -Value $SQL -Force 2>&1
# Try with env if passed in
if ($NR_SQL_USERNAME -and $NR_SQL_PASSWORD) {
if ($NEW_RELIC_MSSQL_SQL_USERNAME -and $NEW_RELIC_MSSQL_SQL_PASSWORD) {
Write-Host "sqlcmd with credentials"
$SqlOutput=(sqlcmd -U $NR_SQL_USERNAME -P $NR_SQL_PASSWORD -S $connection -i $NriSqlFile 2>&1)
$SqlOutput=(sqlcmd -U $NEW_RELIC_MSSQL_SQL_USERNAME -P $NEW_RELIC_MSSQL_SQL_PASSWORD -S $connection -i $NriSqlFile 2>&1)
}
# Env failed or blank, try with default
if ([string]::IsNullOrWhiteSpace($NR_SQL_USERNAME) -or ($SqlOutput.Length -lt 3)){
if ([string]::IsNullOrWhiteSpace($NEW_RELIC_MSSQL_SQL_USERNAME) -or ($SqlOutput.Length -lt 3)){
Write-Host "sqlcmd with no credentials"
$SqlOutput=(sqlcmd -S $connection -i $NriSqlFile 2>&1)
}
Expand Down

0 comments on commit f2b638a

Please sign in to comment.