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:
Ed Bartosh 2018-05-25 18:55:35 +03:00
parent 880dbd339b
commit 25436cdc6a

View File

@ -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) == "" {