|
16 | 16 | import com.typesafe.config.Config;
|
17 | 17 | import com.yugabyte.yw.commissioner.AbstractTaskBase;
|
18 | 18 | import com.yugabyte.yw.commissioner.BaseTaskDependencies;
|
| 19 | +import com.yugabyte.yw.commissioner.ITask.Abortable; |
19 | 20 | import com.yugabyte.yw.commissioner.TaskExecutor.SubTaskGroup;
|
20 | 21 | import com.yugabyte.yw.commissioner.tasks.params.SupportBundleTaskParams;
|
21 | 22 | import com.yugabyte.yw.commissioner.tasks.subtasks.CheckNodeReachable;
|
|
34 | 35 | import com.yugabyte.yw.models.Customer;
|
35 | 36 | import com.yugabyte.yw.models.SupportBundle;
|
36 | 37 | import com.yugabyte.yw.models.SupportBundle.SupportBundleStatusType;
|
| 38 | +import com.yugabyte.yw.models.TaskInfo; |
37 | 39 | import com.yugabyte.yw.models.Universe;
|
38 | 40 | import com.yugabyte.yw.models.helpers.BundleDetails;
|
39 | 41 | import com.yugabyte.yw.models.helpers.NodeDetails;
|
|
52 | 54 | import play.libs.Json;
|
53 | 55 |
|
54 | 56 | @Slf4j
|
| 57 | +@Abortable |
55 | 58 | public class CreateSupportBundle extends AbstractTaskBase {
|
56 | 59 |
|
57 | 60 | @Inject private UniverseInfoHandler universeInfoHandler;
|
@@ -86,11 +89,17 @@ public void run() {
|
86 | 89 | operatorStatusUpdater.markSupportBundleFinished(
|
87 | 90 | supportBundle, taskParams().getKubernetesResourceDetails(), gzipPath);
|
88 | 91 | } catch (Exception e) {
|
89 |
| - taskParams().supportBundle.setStatus(SupportBundleStatusType.Failed); |
90 |
| - operatorStatusUpdater.markSupportBundleFailed( |
91 |
| - supportBundle, taskParams().getKubernetesResourceDetails()); |
92 |
| - Throwables.throwIfUnchecked(e); |
93 |
| - throw new RuntimeException(e); |
| 92 | + TaskInfo taskInfo = getRunnableTask().getTaskInfo(); |
| 93 | + if (taskInfo.getTaskState().equals(TaskInfo.State.Abort)) { |
| 94 | + log.info("Marking support bundle with UUID: {} as aborted.", supportBundle.getBundleUUID()); |
| 95 | + supportBundle.setStatus(SupportBundleStatusType.Aborted); |
| 96 | + } else { |
| 97 | + supportBundle.setStatus(SupportBundleStatusType.Failed); |
| 98 | + operatorStatusUpdater.markSupportBundleFailed( |
| 99 | + supportBundle, taskParams().getKubernetesResourceDetails()); |
| 100 | + Throwables.throwIfUnchecked(e); |
| 101 | + throw new RuntimeException(e); |
| 102 | + } |
94 | 103 | } finally {
|
95 | 104 | supportBundle.update();
|
96 | 105 | }
|
|
0 commit comments