mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Prevent internal conversion in the printer directly (as per implicit contract)
This commit is contained in:
parent
87970bc356
commit
b5c33e1c8c
@ -109,6 +109,9 @@ func NewVersionedPrinter(printer ResourcePrinter, convertor runtime.ObjectConver
|
|||||||
|
|
||||||
// PrintObj implements ResourcePrinter
|
// PrintObj implements ResourcePrinter
|
||||||
func (p *VersionedPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
func (p *VersionedPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||||
|
if len(p.version) == 0 {
|
||||||
|
return fmt.Errorf("no version specified, object cannot be converted")
|
||||||
|
}
|
||||||
converted, err := p.convertor.ConvertToVersion(obj, p.version)
|
converted, err := p.convertor.ConvertToVersion(obj, p.version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user