only construct shortcutmapper when we have the discovery client

This commit is contained in:
deads2k 2017-02-16 11:38:52 -05:00
parent 7d4383c6e1
commit 9b5acdbb88

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)