Browse code

daemon/cluster/executor: use container.ContainerState consts

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2025/05/13 20:47:15
Showing 1 changed files
... ...
@@ -210,7 +210,7 @@ func (r *controller) Start(ctx context.Context) error {
210 210
 	//
211 211
 	// TODO(stevvooe): This is very racy. While reading inspect, another could
212 212
 	// start the process and we could end up starting it twice.
213
-	if ctnr.State.Status != "created" {
213
+	if ctnr.State.Status != container.StateCreated {
214 214
 		return exec.ErrTaskStarted
215 215
 	}
216 216
 
... ...
@@ -467,10 +467,10 @@ func (r *controller) waitReady(pctx context.Context) error {
467 467
 		}
468 468
 	} else {
469 469
 		switch ctnr.State.Status {
470
-		case "running", "exited", "dead":
470
+		case container.StateRunning, container.StateExited, container.StateDead:
471 471
 			return nil
472
-		default:
473
-			// TODO(thaJeztah): make switch exhaustive
472
+		case container.StateCreated, container.StatePaused, container.StateRestarting, container.StateRemoving:
473
+			// not yet ready
474 474
 		}
475 475
 	}
476 476