mirror of
https://github.com/wahyd4/cert-manager.git
synced 2026-08-09 05:06:38 +10:00
Call Options.Complete to set up the version checker command
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
This commit is contained in:
@@ -98,6 +98,7 @@ func NewCmdVersion(ctx context.Context, ioStreams genericclioptions.IOStreams) *
|
||||
Long: versionLong,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Validate())
|
||||
cmdutil.CheckErr(o.Complete())
|
||||
cmdutil.CheckErr(o.Run(ctx))
|
||||
},
|
||||
}
|
||||
@@ -122,20 +123,16 @@ func (o *Options) Validate() error {
|
||||
}
|
||||
|
||||
// Complete takes the command arguments and factory and infers any remaining options.
|
||||
func (o *Options) Complete(factory cmdutil.Factory) error {
|
||||
func (o *Options) Complete() error {
|
||||
if o.ClientOnly {
|
||||
return nil
|
||||
}
|
||||
|
||||
restConfig, err := factory.ToRESTConfig()
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot create the REST config: %v", err)
|
||||
}
|
||||
|
||||
o.VersionChecker, err = versionchecker.New(restConfig, scheme.Scheme)
|
||||
versionChecker, err := versionchecker.New(o.RESTConfig, scheme.Scheme)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.VersionChecker = versionChecker
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user