Merge pull request #39038 from ncdc/fix-kubectl-get-list
Automatic merge from submit-queue Fix kubectl get -f <file> -o <nondefault printer> so it prints all items in the file **What this PR does / why we need it**: Fix kubectl get -f <file> -o <nondefault printer> so it prints all the objects in the file, instead of just the first one. Also add a test for this feature. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #38907 **Special notes for your reviewer**: **Release note**: ```release-note ``` cc @AdoHe @deads2k @liggitt @fabianofranz @kubernetes/kubectl @kubernetes/sig-cli-misc
This commit is contained in:
@@ -197,14 +197,14 @@ func (o AnnotateOptions) RunAnnotate(f cmdutil.Factory, cmd *cobra.Command) erro
|
||||
return err
|
||||
}
|
||||
|
||||
var singularResource bool
|
||||
r.IntoSingular(&singularResource)
|
||||
var singleItemImpliedResource bool
|
||||
r.IntoSingleItemImplied(&singleItemImpliedResource)
|
||||
|
||||
// only apply resource version locking on a single resource.
|
||||
// we must perform this check after o.builder.Do() as
|
||||
// []o.resources can not not accurately return the proper number
|
||||
// of resources when they are not passed in "resource/name" format.
|
||||
if !singularResource && len(o.resourceVersion) > 0 {
|
||||
if !singleItemImpliedResource && len(o.resourceVersion) > 0 {
|
||||
return fmt.Errorf("--resource-version may only be used with a single resource")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user