Unverified Commit 1bb6fa84 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 6b217274 25436cdc
...@@ -215,7 +215,7 @@ func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker, ...@@ -215,7 +215,7 @@ func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker,
resetWithDocker(execer, dockerCheck) resetWithDocker(execer, dockerCheck)
return return
} }
sandboxes := strings.Split(string(output), " ") sandboxes := strings.Fields(string(output))
glog.V(1).Infoln("[reset] Stopping and removing running containers using crictl") glog.V(1).Infoln("[reset] Stopping and removing running containers using crictl")
for _, s := range sandboxes { for _, s := range sandboxes {
if strings.TrimSpace(s) == "" { if strings.TrimSpace(s) == "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment