Merge pull request #52051 from juanvallejo/jvallejo/acknowledge-show-all-kubectl-get-watch

Automatic merge from submit-queue (batch tested with PRs 52168, 48939, 51889, 52051, 50396). 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>..

acknowledge --show-all=false with --watch

**Release note**:
```release-note
NONE
```

Allow the `--show-all=false` option to work when invoking `kubectl get ...` with the `--watch` option enabled.

Related downstream issue: https://github.com/openshift/origin/issues/14975

cc @fabianofranz @kubernetes/sig-cli-misc @kargakis
pull/6/head
Kubernetes Submit Queue 2017-09-23 13:40:53 -07:00 committed by GitHub
commit 48bb3e6cde
1 changed files with 15 additions and 3 deletions

View File

@ -279,8 +279,12 @@ func RunGet(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args [
objsToPrint = append(objsToPrint, obj)
}
for _, objToPrint := range objsToPrint {
if err := printer.PrintObj(objToPrint, writer); err != nil {
return fmt.Errorf("unable to output the provided object: %v", err)
if isFiltered, err := filterFuncs.Filter(objToPrint, filterOpts); !isFiltered {
if err != nil {
glog.V(2).Infof("Unable to filter resource: %v", err)
} else if err := printer.PrintObj(objToPrint, writer); err != nil {
return fmt.Errorf("unable to output the provided object: %v", err)
}
}
}
writer.Flush()
@ -301,7 +305,15 @@ func RunGet(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args [
first = false
return false, nil
}
return false, printer.PrintObj(e.Object, out)
if isFiltered, err := filterFuncs.Filter(e.Object, filterOpts); !isFiltered {
if err != nil {
glog.V(2).Infof("Unable to filter resource: %v", err)
} else if err := printer.PrintObj(e.Object, out); err != nil {
return false, err
}
}
return false, nil
})
return err
})