mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
make logic more explicit
This commit is contained in:
parent
ed0ca92439
commit
795cc54679
1 changed files with 6 additions and 7 deletions
13
main.go
13
main.go
|
|
@ -91,18 +91,17 @@ func validateFile(r io.Reader, regs []registry.Registry, k8sVersion string, c *c
|
|||
cacheKey := cache.Key(sig.Kind, sig.Version, k8sVersion)
|
||||
schema, ok := c.Get(cacheKey)
|
||||
if !ok {
|
||||
if schema, err = downloadSchema(regs, sig.Kind, sig.Version, k8sVersion); err != nil {
|
||||
schema, err = downloadSchema(regs, sig.Kind, sig.Version, k8sVersion)
|
||||
if err != nil {
|
||||
validationResults = append(validationResults, validationResult{kind: sig.Kind, version: sig.Version, err: err, skipped: false})
|
||||
continue
|
||||
}
|
||||
|
||||
if schema == nil {
|
||||
validationResults = append(validationResults, validationResult{kind: sig.Kind, version: sig.Version, err: nil, skipped: true}) // skip if no schema found
|
||||
} else if schema == nil { // skip if no schema was found, but there was no error
|
||||
validationResults = append(validationResults, validationResult{kind: sig.Kind, version: sig.Version, err: nil, skipped: true})
|
||||
c.Set(cacheKey, nil)
|
||||
continue
|
||||
} else {
|
||||
c.Set(cacheKey, schema)
|
||||
}
|
||||
|
||||
c.Set(cacheKey, schema)
|
||||
}
|
||||
|
||||
if err = validator.Validate(rawResource, schema); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue