mirror of
https://github.com/outbackdingo/kubernetes.git
synced 2026-02-26 12:50:35 +00:00
Return error instead of panic if container index outside bounds
Adds check for index out of bounds error instead of panic when passing container to kubectl exec. Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
This commit is contained in:
@@ -1059,6 +1059,9 @@ func formatVolume(f *framework.Framework, pod *v1.Pod) {
|
||||
}
|
||||
|
||||
func podContainerExec(pod *v1.Pod, containerIndex int, command string) (string, error) {
|
||||
if containerIndex > len(pod.Spec.Containers)-1 {
|
||||
return "", fmt.Errorf("container not found in pod: index %d", containerIndex)
|
||||
}
|
||||
var shell string
|
||||
var option string
|
||||
if framework.NodeOSDistroIs("windows") {
|
||||
|
||||
Reference in New Issue
Block a user