fix panic issue (#690)
This commit is contained in:
parent
2d98bba1a1
commit
65eca3337e
|
|
@ -943,7 +943,10 @@ func (a *App) ForEachState(do func(*Run) (bool, []error), includeTransitiveNeeds
|
|||
err := a.visitStatesWithSelectorsAndRemoteSupport(a.FileOrDir, func(st *state.HelmState) (bool, []error) {
|
||||
helm := a.getHelm(st)
|
||||
|
||||
run := NewRun(st, helm, ctx)
|
||||
run, err := NewRun(st, helm, ctx)
|
||||
if err != nil {
|
||||
return false, []error{err}
|
||||
}
|
||||
return do(run)
|
||||
}, includeTransitiveNeeds, o...)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ type Run struct {
|
|||
Ask func(string) bool
|
||||
}
|
||||
|
||||
func NewRun(st *state.HelmState, helm helmexec.Interface, ctx Context) *Run {
|
||||
func NewRun(st *state.HelmState, helm helmexec.Interface, ctx Context) (*Run, error) {
|
||||
if helm == nil {
|
||||
panic("Assertion failed: helmexec.Interface must not be nil")
|
||||
return nil, fmt.Errorf("Assertion failed: helmexec.Interface must not be nil")
|
||||
}
|
||||
|
||||
if !helm.IsHelm3() {
|
||||
panic("helmfile has deprecated helm2 since v1.0")
|
||||
return nil, fmt.Errorf("helmfile has deprecated helm2 since v0.150.0")
|
||||
}
|
||||
|
||||
return &Run{state: st, helm: helm, ctx: ctx}
|
||||
return &Run{state: st, helm: helm, ctx: ctx}, nil
|
||||
}
|
||||
|
||||
func (r *Run) askForConfirmation(msg string) bool {
|
||||
|
|
|
|||
Loading…
Reference in New Issue