Merge pull request #1271 from mcintyre94/CA-228723

[CA-228723]  Cancelling update installation leaves the update in xapi db
This commit is contained in:
Mihaela Stoica 2016-11-10 14:45:51 +00:00 committed by GitHub
commit 30a5f36515

View File

@ -380,16 +380,28 @@ namespace XenAdmin.Wizards.PatchingWizard
{
if (PatchingWizard_UploadPage.AllIntroducedPoolUpdates != null && PatchingWizard_UploadPage.AllIntroducedPoolUpdates.Count > 0)
{
return PatchingWizard_UploadPage.AllIntroducedPoolUpdates.Select(pu => GetCleanUpPoolUpdateAction(pu)).ToList();
return PatchingWizard_UploadPage.AllIntroducedPoolUpdates.Select(GetCleanUpPoolUpdateAction).ToList();
}
return new List<AsyncAction>();
}
private AsyncAction GetCleanUpPoolUpdateAction(Pool_update poolUpdate)
private static AsyncAction GetCleanUpPoolUpdateAction(Pool_update poolUpdate)
{
return
new DelegatedAsyncAction(poolUpdate.Connection, Messages.REMOVE_PATCH, "", "", session => Pool_update.pool_clean(session, poolUpdate.opaque_ref));
new DelegatedAsyncAction(poolUpdate.Connection, Messages.REMOVE_PATCH, "", "", session =>
{
try
{
Pool_update.pool_clean(session, poolUpdate.opaque_ref);
if(!poolUpdate.AppliedOnHosts.Any())
Pool_update.destroy(session, poolUpdate.opaque_ref);
}
catch (Failure f)
{
log.Error("Clean up failed", f);
}
});
}
}
}