New ๐ŸŒŠ wave for @helm

Commit 3e945981

3e94598124e5Merged

Dmitriy Zhilyaev <[email protected]> ยท 5 years ago ยท 1 file ยท ~1 modified

Description

Merge pull request #180 from helmwave/fix-validate-dublicate

Fix validate dublicate

Details

Commit
3e94598124e5
Parent
17a029c8081d
Merge parent
cefba71c75ec

pkg/plan/validate.gomodifiedView file

@@ -6,6 +6,7 @@
66 "os"
77 "regexp"
88
9+ "github.com/helmwave/helmwave/pkg/release/uniqname"
910 log "github.com/sirupsen/logrus"
1011 )
1112
@@ -73,16 +74,12 @@
7374 }
7475
7576 func (p *planBody) ValidateReleases() error {
76- a := make(map[string]int8)
77+ a := make(map[uniqname.UniqName]int8)
7778 for _, r := range p.Releases {
7879 if r.Name == "" {
7980 return errors.New("release name is empty")
8081 }
8182
82- if !r.Uniq().Validate() {
83- return errors.New("bad uniqname: " + string(r.Uniq()))
84- }
85-
8683 if r.Namespace == "" {
8784 log.Warnf("namespace for %q is empty. I will use the namespace of your k8s context.", r.Uniq())
8885 }
@@ -91,9 +88,13 @@
9188 return errors.New("bad namespace: " + r.Namespace)
9289 }
9390
94- a[r.Name]++
95- if a[r.Name] > 1 {
96- return errors.New("release name duplicate: " + r.Name)
91+ if !r.Uniq().Validate() {
92+ return errors.New("bad uniqname: " + string(r.Uniq()))
93+ }
94+
95+ a[r.Uniq()]++
96+ if a[r.Uniq()] > 1 {
97+ return errors.New("release duplicate: " + string(r.Uniq()))
9798 }
9899 }
99100