Retention Policy Fatal failure when package path does not exist

Hi,

I have setup a retention policy and applied it to a set of projects. When deploying, the retention policy is being applied correctly, however if I deploy to a server that has possibly manually been cleaned up or not had all the versions of a particular package deployed, the retention policy code still tries to delete the package even if it does not exist, causing a failure. The deploy process is stopped at this stage and deployment does not continue.

Below is an example of the error

2012-11-30 07:44:58 DEBUG Removing old installation: D:\Octopus\Applications\SYSTESTB\Shared.Tools\2.38.163.0
2012-11-30 07:44:58 WARN An error occurred when applying the retention policy: Could not find a part of the path ‘D:\Octopus\Applications\SYSTESTB\Shared.Tools\2.38.163.0’. System.IO.DirectoryNotFoundException: Could not find a part of the path ‘D:\Octopus\Applications\SYSTESTB\Shared.Tools\2.38.163.0’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive)
at Octopus.Tentacle.Deployment.Journal.DeploymentJournal.ApplyRetentionPolicy(JournalEntry journalEntry, IActivityLog log) in c:\BuildAgent\work\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournal.cs:line 88
at Octopus.Tentacle.Deployment.Journal.DeploymentJournal.AppendSuccessfulDeployment(JournalEntry journalEntry, IActivityLog log) in c:\BuildAgent\work\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Journal\DeploymentJournal.cs:line 35

After looking at a few tentacles I can confirm that this seems to be related to a task we had running that cleaned up the extracted package folders due to our high deployment rate, however we didn’t go and edit the Deployments.xml which I have just now seen, a simple check for existence before deleting would take care of the error.

Thanks for getting in touch Eugene, this will be fixed in the next release.

Paul