Skip to content

Commit

Permalink
Update un-install to only run when app is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien4218 committed Feb 19, 2021
1 parent b46c667 commit 2ef19d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion recipes/newrelic/apm/dotNet/windows/net-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ install:
remove_any_previous:
ignore_error: true
cmds:
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name like 'New Relic .NET Agent%'"; $app.Uninstall()'
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name like 'New Relic .NET Agent%'"; if ($app) { $app.Uninstall() }'

install:
cmds:
Expand Down
4 changes: 2 additions & 2 deletions recipes/newrelic/infrastructure/ohi/sql/ms-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ install:

assert_pre_req:
cmds:
- powershell -command '$output = Get-Service "newrelic-infra"; if ( -not ($output -like "*newrelic-infra*") ) { Write-Error "The newrelic-infra agent service is not installed on the host, but is required to install this integration." }'
- powershell -command '$output = Get-Service "newrelic-infra"; if ( -not ($output -like "*newrelic-infra*") ) { Write-Error "The newrelic-infra agent service is not installed on the host, but is required to install this integration. Please install the newrelic infrastructure agent." }'
- powershell -command '$output = sqlcmd -S {{.NR_CLI_DB_HOSTNAME}},{{.NR_CLI_DB_PORT}} -U {{.NR_CLI_DB_USERNAME}} -P "{{.NR_CLI_DB_PASSWORD}}" -Q "SELECT GETDATE()"; if ( -not ($output -like "*rows affected*") ) { Write-Error "Cannot connect to the SQL Server instance {{.NR_CLI_DB_HOSTNAME}} with the provided username {{.NR_CLI_DB_USERNAME}} and password." }'

remove_any_previous:
ignore_error: true
cmds:
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'New Relic Infrastructure Integration, nri-mssql'"; $app.Uninstall()'
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'New Relic Infrastructure Integration, nri-mssql'"; if ($app) { $app.Uninstall() }'

install:
label: "Installing Microsoft SQL Server integration..."
Expand Down
2 changes: 1 addition & 1 deletion recipes/newrelic/infrastructure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install:
ignore_error: true
cmds:
- powershell -command 'net stop newrelic-infra'
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'New Relic Infrastructure Agent'"; $app.Uninstall()'
- powershell -command '$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'New Relic Infrastructure Agent'"; if ($app) { $app.Uninstall() }'

install:
cmds:
Expand Down

0 comments on commit 2ef19d8

Please sign in to comment.