diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs index cee5e7bed..0acd86edd 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs @@ -250,10 +250,7 @@ namespace XenAdmin.Wizards.PatchingWizard RunMultipleActions(Messages.REVERT_WIZARD_CHANGES, Messages.REVERTING_WIZARD_CHANGES, Messages.REVERTED_WIZARD_CHANGES, subActions); - if (PatchingWizard_SelectPatchPage.SelectedUpdateAlert != null && PatchingWizard_UploadPage.SelectedNewPatch != null) - { - File.Delete(PatchingWizard_UploadPage.SelectedNewPatch); - } + RemoveDownloadedPatches(); base.OnCancel(); } @@ -270,6 +267,14 @@ namespace XenAdmin.Wizards.PatchingWizard RunMultipleActions(Messages.REMOVE_UPDATES, Messages.REMOVING_UPDATES, Messages.REMOVED_UPDATES, subActions); } + private void RemoveDownloadedPatches() + { + foreach (string downloadedPatch in PatchingWizard_UploadPage.AllDownloadedPatches) + { + File.Delete(downloadedPatch); + } + } + protected override void FinishWizard() { if (PatchingWizard_UploadPage.NewUploadedPatches != null) @@ -284,10 +289,7 @@ namespace XenAdmin.Wizards.PatchingWizard if (PatchingWizard_UploadPage.AllCreatedSuppPackVdis != null) RemoveTemporaryVdis(); - if (PatchingWizard_SelectPatchPage.SelectedUpdateAlert != null) - { - File.Delete(PatchingWizard_UploadPage.SelectedNewPatch); - } + RemoveDownloadedPatches(); base.FinishWizard(); } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs index bbbb3bcb7..e246a3630 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs @@ -45,6 +45,7 @@ namespace XenAdmin.Wizards.PatchingWizard get { return _patch; } } + public List AllDownloadedPatches = new List(); public readonly List AllCreatedSuppPackVdis = new List(); public Dictionary SuppPackVdis = new Dictionary(); @@ -367,6 +368,7 @@ namespace XenAdmin.Wizards.PatchingWizard if (action is DownloadAndUnzipXenServerPatchAction) { SelectedNewPatch = ((DownloadAndUnzipXenServerPatchAction)action).PatchPath; + AllDownloadedPatches.Add(SelectedNewPatch); PrepareUploadActions(); TryUploading(); }