OctopusDeploy / Library

| Public | A repository of step templates and other community-contributed extensions to Octopus Deploy
Other
171 stars 503 forks source link

Updating postgres template #1515

Closed twerthi closed 5 months ago

twerthi commented 6 months ago

Background

This template uses a PowerShell module called SimplySql. The module has been updated to include the ability to specify a connection name. The finally statement attempts to ensure that all connections are closed, however, in cases where the connection was never established, the finally statement would fail and mask the original error. This PR adds the connection name as well as a test to see if the close statement needs to be called so the original error doesn't get buried.

Results

The added test will now expose the error that was encountered.

Before

If no connection was established due to an error, the finally statement would mask the error as it could not close.

After

The template now tests for a connection, if nothing was found, it will not attempt to close and expose the original error.

Pre-requisites