Example #1
0
 private static AsyncAction GetCleanUpPoolUpdateAction(Pool_update poolUpdate)
 {
     return
         (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);
         }
     }));
 }
Example #2
0
        private AsyncAction GetCleanActionForPoolUpdate(Pool_update update)
        {
            if (update == null || update.Connection == null || !update.Connection.IsConnected)
            {
                return(null);
            }

            return(new DelegatedAsyncAction(update.Connection, Messages.REMOVE_PATCH, "", "", session =>
            {
                try
                {
                    Pool_update.pool_clean(session, update.opaque_ref);
                    if (!update.AppliedOnHosts().Any())
                    {
                        Pool_update.destroy(session, update.opaque_ref);
                    }
                }
                catch (Failure f)
                {
                    log.Error("Clean up failed", f);
                }
            }));
        }
        private void RemoveSuppPackFromMaster(Session session, Host master, string suppPack, Pool_update update)
        {
            var isLastHostInPool = hosts.IndexOf(host) == hosts.Count - 1;

            if (isLastHostInPool)
            {
                try
                {
                    AddProgressStep(string.Format(Messages.UPDATES_WIZARD_REMOVING_UPDATES_FROM_POOL, suppPack));

                    Pool_update.pool_clean(session, update.opaque_ref);
                    if (!update.AppliedOnHosts().Any())
                    {
                        Pool_update.destroy(session, update.opaque_ref);
                    }

                    uploadedSuppPacks.Remove(master);
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("Remove update file from master failed on host {0}", master.Name()), ex);
                }
            }
        }