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\188.8.131.52
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\184.108.40.206’. System.IO.DirectoryNotFoundException: Could not find a part of the path ‘D:\Octopus\Applications\SYSTESTB\Shared.Tools\220.127.116.11’.
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