protected override void Run() { PercentComplete = 0; var exceptions = new List <Exception>(); RecomputeCanCancel(); RunSubActions(exceptions); PercentComplete = 100; Description = endDescription; if (exceptions.Count > 1) { foreach (Exception e in exceptions) { log.Error(e); } Exception = new Exception(Messages.SOME_ERRORS_ENCOUNTERED); } if (Cancelling) { Exception = new CancelledException(); } }
private void SetFatalErrorData(Task task) { string[] err = task.error_info; if (err != null && err.Length > 0) { Exception = new Failure(err); } else if (task.status == task_status_type.cancelled) { Exception = new CancelledException(); } }
protected override void RunWithSession(ref Session session) { //Show dialog prepare host boot from CD or PXE boot and click OK to reboot Program.Invoke(invokingControl, () => { using (var dialog = new InformationDialog(string.Format(Messages.ROLLING_UPGRADE_REBOOT_MESSAGE, GetResolvedHost().Name()), new ThreeButtonDialog.TBDButton(Messages.REBOOT, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.SKIP_SERVER, DialogResult.Cancel)) { WindowTitle = Messages.ROLLING_POOL_UPGRADE }) { if (dialog.ShowDialog(invokingControl) != DialogResult.OK) // Cancel or Unknown { if (GetResolvedHost().IsMaster()) { Error = new ApplicationException(Messages.EXCEPTION_USER_CANCELLED_MASTER); throw Error; } Error = new CancelledException(); } } }); if (Error != null) { return; } var hostObj = GetResolvedHost(); string beforeRebootProductVersion = hostObj.LongProductVersion(); string hostName = hostObj.Name(); do { if (Cancelling) { break; } Upgrade(ref session); hostObj = GetResolvedHost(); if (Helpers.SameServerVersion(hostObj, beforeRebootProductVersion)) { var obj = hostObj; Program.Invoke(invokingControl, () => { using (var dialog = new WarningDialog(string.Format(Messages.ROLLING_UPGRADE_REBOOT_AGAIN_MESSAGE, hostName), new ThreeButtonDialog.TBDButton(Messages.REBOOT_AGAIN_BUTTON_LABEL, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.SKIP_SERVER, DialogResult.Cancel)) { WindowTitle = Messages.ROLLING_POOL_UPGRADE }) { if (dialog.ShowDialog(invokingControl) == DialogResult.OK) { return; } if (obj.IsMaster()) { Error = new Exception(Messages.HOST_REBOOTED_SAME_VERSION); throw Error; } Error = new CancelledException(); Cancel(); } }); } else { break; } } while (true); }
private void SetFatalErrorData(Task task) { string[] err = task.error_info; if (err != null && err.Length > 0) Exception = new Failure(err); else if (task.status == task_status_type.cancelled) Exception = new CancelledException(); }