mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
kubectl: run - remove unneeded vars
No need extra vars just for a single validation. Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
This commit is contained in:
parent
d73693cb44
commit
ea017e53af
@ -273,13 +273,12 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
|
||||
}
|
||||
|
||||
// validate image name
|
||||
imageName := o.Image
|
||||
if imageName == "" {
|
||||
if o.Image == "" {
|
||||
return fmt.Errorf("--image is required")
|
||||
}
|
||||
validImageRef := reference.ReferenceRegexp.MatchString(imageName)
|
||||
if !validImageRef {
|
||||
return fmt.Errorf("Invalid image name %q: %v", imageName, reference.ErrReferenceInvalidFormat)
|
||||
|
||||
if !reference.ReferenceRegexp.MatchString(o.Image) {
|
||||
return fmt.Errorf("Invalid image name %q: %v", o.Image, reference.ErrReferenceInvalidFormat)
|
||||
}
|
||||
|
||||
if o.TTY && !o.Interactive {
|
||||
|
Loading…
Reference in New Issue
Block a user