mirror of https://github.com/k3s-io/k3s
Merge pull request #31604 from ping035627/ping035627-patch-0830-1
Automatic merge from submit-queue Return all the invalid parameters for set_image Suggest returning all the invalid parameters for "ImageOptions.Validate()" in set_image.go.pull/6/head
commit
4389446d4e
|
@ -147,15 +147,16 @@ func (o *ImageOptions) Complete(f *cmdutil.Factory, cmd *cobra.Command, args []s
|
|||
}
|
||||
|
||||
func (o *ImageOptions) Validate() error {
|
||||
errors := []error{}
|
||||
if len(o.Resources) < 1 && len(o.Filenames) == 0 {
|
||||
return fmt.Errorf("one or more resources must be specified as <resource> <name> or <resource>/<name>")
|
||||
errors = append(errors, fmt.Errorf("one or more resources must be specified as <resource> <name> or <resource>/<name>"))
|
||||
}
|
||||
if len(o.ContainerImages) < 1 {
|
||||
return fmt.Errorf("at least one image update is required")
|
||||
errors = append(errors, fmt.Errorf("at least one image update is required"))
|
||||
} else if len(o.ContainerImages) > 1 && hasWildcardKey(o.ContainerImages) {
|
||||
return fmt.Errorf("all containers are already specified by *, but saw more than one container_name=container_image pairs")
|
||||
errors = append(errors, fmt.Errorf("all containers are already specified by *, but saw more than one container_name=container_image pairs"))
|
||||
}
|
||||
return nil
|
||||
return utilerrors.NewAggregate(errors)
|
||||
}
|
||||
|
||||
func (o *ImageOptions) Run() error {
|
||||
|
|
Loading…
Reference in New Issue