mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
validate resource opts (#759)
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
This commit is contained in:
parent
15973bc6b4
commit
dc952c1a60
1 changed files with 19 additions and 4 deletions
|
|
@ -238,10 +238,6 @@ func (k *kubectlResourceOperations) ReplaceResource(ctx context.Context, obj *un
|
|||
return err
|
||||
}
|
||||
|
||||
if err := replaceOptions.Validate(); err != nil {
|
||||
return fmt.Errorf("error validating replace options: %w", err)
|
||||
}
|
||||
|
||||
return replaceOptions.Run(k.fact)
|
||||
})
|
||||
}
|
||||
|
|
@ -433,6 +429,10 @@ func (k *kubectlServerSideDiffDryRunApplier) newApplyOptions(ioStreams genericcl
|
|||
}
|
||||
|
||||
o.ForceConflicts = true
|
||||
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("error validating options: %w", err)
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
|
|
@ -462,6 +462,10 @@ func (k *kubectlResourceOperations) newApplyOptions(ioStreams genericclioptions.
|
|||
if serverSideApply {
|
||||
o.ForceConflicts = true
|
||||
}
|
||||
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("error validating options: %w", err)
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
|
|
@ -496,6 +500,10 @@ func (k *kubectlResourceOperations) newCreateOptions(ioStreams genericclioptions
|
|||
return printer.PrintObj(obj, o.Out)
|
||||
}
|
||||
o.FilenameOptions.Filenames = []string{fileName}
|
||||
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("error validating options: %w", err)
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
|
|
@ -551,6 +559,9 @@ func (k *kubectlResourceOperations) newReplaceOptions(config *rest.Config, f cmd
|
|||
o.DeleteOptions.ForceDeletion = force
|
||||
}
|
||||
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("error validating options: %w", err)
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
|
|
@ -580,6 +591,10 @@ func newReconcileOptions(f cmdutil.Factory, kubeClient *kubernetes.Clientset, fi
|
|||
return nil, fmt.Errorf("error configuring printer: %w", err)
|
||||
}
|
||||
o.PrintObject = printer.PrintObj
|
||||
|
||||
if err := o.Validate(); err != nil {
|
||||
return nil, fmt.Errorf("error validating options: %w", err)
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue