11package planmanager
22
33import (
4+ "fmt"
45 "log"
56 "time"
67
@@ -50,8 +51,8 @@ func NewPlan(smgr statemanager.Manager, cfg *configloader.Config) *Plan {
5051
5152// Execute will execute all changes included in the Plan and record results.
5253// All errors will be return.
53- func (p * Plan ) Execute () [ ]error {
54- errors := make ([ ]error , 0 )
54+ func (p * Plan ) Execute () map [ string ]error {
55+ errorsMap := make (map [ string ]error )
5556 log .Printf ("changes count: %d" , len (p .Changes ))
5657 for i , c := range p .Changes {
5758 log .Printf ("processing progress: %d/%d" , i + 1 , len (p .Changes ))
@@ -60,7 +61,8 @@ func (p *Plan) Execute() []error {
6061 // It involves dependency management.
6162 succeeded , err := c .Action (c .Tool )
6263 if err != nil {
63- errors = append (errors , err )
64+ key := fmt .Sprintf ("%s-%s" , c .Tool .Name , c .ActionName )
65+ errorsMap [key ] = err
6466 }
6567
6668 c .Result = & ChangeResult {
@@ -71,8 +73,8 @@ func (p *Plan) Execute() []error {
7173
7274 err = p .handleResult (c )
7375 if err != nil {
74- errors = append ( errors , err )
76+ errorsMap [ "handle-result" ] = err
7577 }
7678 }
77- return errors
79+ return errorsMap
7880}
0 commit comments