Browse code

Fix debugging pods with multiple containers

Fabiano Franz authored on 2016/08/03 07:20:27
Showing 1 changed files
... ...
@@ -344,6 +344,7 @@ func (o *DebugOptions) Debug() error {
344 344
 			return err
345 345
 		}
346 346
 		fmt.Fprintf(o.Attach.Err, "Waiting for pod to start ...\n")
347
+
347 348
 		switch containerRunningEvent, err := watch.Until(o.Timeout, w, kclient.PodContainerRunning(o.Attach.ContainerName)); {
348 349
 		// api didn't error right away but the pod wasn't even created
349 350
 		case kapierrors.IsNotFound(err):
... ...
@@ -352,8 +353,8 @@ func (o *DebugOptions) Debug() error {
352 352
 				msg += fmt.Sprintf(" on node %q", o.NodeName)
353 353
 			}
354 354
 			return fmt.Errorf(msg)
355
-		// switch to logging output
356
-		case err == kclient.ErrPodCompleted, !o.Attach.Stdin:
355
+			// switch to logging output
356
+		case err == kclient.ErrPodCompleted, err == kclient.ErrContainerTerminated, !o.Attach.Stdin:
357 357
 			_, err := kcmd.LogsOptions{
358 358
 				Object: pod,
359 359
 				Options: &kapi.PodLogOptions{