mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 13:31:52 +00:00
fix parsing 'crictl pods -q' output
Output of crictl pods -q is a list of running pod ids, one id per line. Current code splits this output incorrectly which makes next command 'crictl stopp' fail if there is more than one pod running. Should be fixed by using strings.Fields instead of strings.Split.
This commit is contained in:
parent
880dbd339b
commit
25436cdc6a
@ -215,7 +215,7 @@ func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker,
|
||||
resetWithDocker(execer, dockerCheck)
|
||||
return
|
||||
}
|
||||
sandboxes := strings.Split(string(output), " ")
|
||||
sandboxes := strings.Fields(string(output))
|
||||
glog.V(1).Infoln("[reset] Stopping and removing running containers using crictl")
|
||||
for _, s := range sandboxes {
|
||||
if strings.TrimSpace(s) == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user