@@ -1121,12 +1121,13 @@ func gatherSystemTime(ctx context.Context,
11211121 buf = writeSystemTime (buf , pod , stdout , stderr )
11221122 break
11231123 } else if err != nil {
1124- // If we get an RBAC error, let the user know. Otherwise, just
1125- // try the next container.
1124+ // If we get an RBAC error, let the user know and try the next pod.
1125+ // Otherwise, try the next container.
11261126 if apierrors .IsForbidden (err ) {
11271127 writeInfo (cmd , fmt .Sprintf (
1128- "Failed to get system time for Container \" %s\" in Pod \" %s\" . Error: \" %s\" " ,
1129- container .Name , pod .GetName (), err .Error ()))
1128+ "Failed to get system time for Pod \" %s\" . Error: \" %s\" " ,
1129+ pod .GetName (), err .Error ()))
1130+ break
11301131 }
11311132 continue
11321133 }
@@ -1218,12 +1219,13 @@ func gatherProcessInfo(ctx context.Context,
12181219
12191220 stdout , stderr , err := Executor (exec ).processes ()
12201221 if err != nil {
1221- // If we get an RBAC error, let the user know. Otherwise, just
1222- // try the next container.
1222+ // If we get an RBAC error, let the user know and try the next pod.
1223+ // Otherwise, try the next container.
12231224 if apierrors .IsForbidden (err ) {
12241225 writeInfo (cmd , fmt .Sprintf (
1225- "Failed to get processes for Container \" %s\" in Pod \" %s\" . Error: \" %s\" " ,
1226- container .Name , pod .GetName (), err .Error ()))
1226+ "Failed to get processes for Pod \" %s\" . Error: \" %s\" " ,
1227+ pod .GetName (), err .Error ()))
1228+ break
12271229 }
12281230 continue
12291231 }
0 commit comments