mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-09 18:35:56 +02:00
fix panic issue (#690)
This commit is contained in:
+4
-1
@@ -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...)
|
||||
|
||||
|
||||
+4
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user