Merge pull request #41570 from deads2k/cli-03-tolerate-missing-shortcut

Automatic merge from submit-queue

only construct shortcutmapper when we have the discovery client

Resource shortnames come from the discoveryclient, so we should only wrap with that mapper when we have the information we need.
This commit is contained in:
Kubernetes Submit Queue 2017-02-16 19:45:44 -08:00 committed by GitHub
commit f0b58a7bed

View File

@ -72,11 +72,12 @@ func (f *ring1Factory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
api.Registry.RESTMapper(), // hardcoded fall back
},
}
}
// wrap with shortcuts
mapper, err = NewShortcutExpander(mapper, discoveryClient)
CheckErr(err)
// wrap with shortcuts, they require a discoveryClient
mapper, err = NewShortcutExpander(mapper, discoveryClient)
// you only have an error on missing discoveryClient, so this shouldn't fail. Check anyway.
CheckErr(err)
}
// wrap with output preferences
cfg, err := f.clientAccessFactory.ClientConfigForVersion(nil)