mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
ResourcePrinter should pass all versions at once
Rather than one at a time.
This commit is contained in:
parent
5f8366aac3
commit
e54d974a12
@ -195,20 +195,11 @@ func (p *VersionedPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
|||||||
if len(p.versions) == 0 {
|
if len(p.versions) == 0 {
|
||||||
return fmt.Errorf("no version specified, object cannot be converted")
|
return fmt.Errorf("no version specified, object cannot be converted")
|
||||||
}
|
}
|
||||||
for _, version := range p.versions {
|
converted, err := p.converter.ConvertToVersion(obj, unversioned.GroupVersions(p.versions))
|
||||||
if version.IsEmpty() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
converted, err := p.converter.ConvertToVersion(obj, version)
|
|
||||||
if runtime.IsNotRegisteredError(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return p.printer.PrintObj(converted, w)
|
return p.printer.PrintObj(converted, w)
|
||||||
}
|
|
||||||
return fmt.Errorf("the object cannot be converted to any of the versions: %v", p.versions)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement HandledResources()
|
// TODO: implement HandledResources()
|
||||||
|
Loading…
Reference in New Issue
Block a user