Merge pull request #64322 from bart0sh/PR0014-fix-parsing-crictl-pods

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix parsing 'crictl pods -q' output

**What this PR does / why we need it**:

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.

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue
2018-05-30 09:59:24 -07:00
committed by GitHub

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