refactor(engine): remove dead failed map from markFailed
This commit is contained in:
@@ -80,7 +80,6 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
results := make(map[string]*ModuleResult, len(mods))
|
results := make(map[string]*ModuleResult, len(mods))
|
||||||
failed := make(map[string]bool)
|
|
||||||
skipped := make(map[string]bool)
|
skipped := make(map[string]bool)
|
||||||
|
|
||||||
for _, id := range order {
|
for _, id := range order {
|
||||||
@@ -96,7 +95,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
res.Status = StatusFailed
|
res.Status = StatusFailed
|
||||||
res.Err = fmt.Errorf("detect: %w", err)
|
res.Err = fmt.Errorf("detect: %w", err)
|
||||||
markFailed(metas, id, failed, skipped)
|
markFailed(metas, id, skipped)
|
||||||
if opts.HaltOnError {
|
if opts.HaltOnError {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -107,7 +106,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
res.Status = StatusFailed
|
res.Status = StatusFailed
|
||||||
res.Err = fmt.Errorf("plan: %w", err)
|
res.Err = fmt.Errorf("plan: %w", err)
|
||||||
markFailed(metas, id, failed, skipped)
|
markFailed(metas, id, skipped)
|
||||||
if opts.HaltOnError {
|
if opts.HaltOnError {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -123,7 +122,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
|
|||||||
if err := m.Apply(ctx, plan, opts.Reporter); err != nil {
|
if err := m.Apply(ctx, plan, opts.Reporter); err != nil {
|
||||||
res.Status = StatusFailed
|
res.Status = StatusFailed
|
||||||
res.Err = fmt.Errorf("apply: %w", err)
|
res.Err = fmt.Errorf("apply: %w", err)
|
||||||
markFailed(metas, id, failed, skipped)
|
markFailed(metas, id, skipped)
|
||||||
if opts.HaltOnError {
|
if opts.HaltOnError {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -132,7 +131,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
|
|||||||
if err := m.Verify(ctx); err != nil {
|
if err := m.Verify(ctx); err != nil {
|
||||||
res.Status = StatusFailed
|
res.Status = StatusFailed
|
||||||
res.Err = fmt.Errorf("verify: %w", err)
|
res.Err = fmt.Errorf("verify: %w", err)
|
||||||
markFailed(metas, id, failed, skipped)
|
markFailed(metas, id, skipped)
|
||||||
if opts.HaltOnError {
|
if opts.HaltOnError {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -172,8 +171,7 @@ func resolveSelection(reg *module.Registry, selected []string) ([]module.Module,
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func markFailed(metas []module.Meta, id string, failed, skipped map[string]bool) {
|
func markFailed(metas []module.Meta, id string, skipped map[string]bool) {
|
||||||
failed[id] = true
|
|
||||||
for d := range Descendants(metas, id) {
|
for d := range Descendants(metas, id) {
|
||||||
skipped[d] = true
|
skipped[d] = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user