Commit 4389446d authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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.
parents 099d47f0 8ec61c1d
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment