Skip to content

Commit 689fa9f

Browse files
committed
fix(parser): check ]
1 parent 48a6992 commit 689fa9f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

services/tasks/stage_parsers/ansible_play.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package stage_parsers
33
import (
44
"github.com/semaphoreui/semaphore/db"
55
"github.com/semaphoreui/semaphore/util"
6+
log "github.com/sirupsen/logrus"
67
"regexp"
78
"strings"
89
)
@@ -84,6 +85,15 @@ func (p AnsibleRunningStageParser) Parse(currentStage *db.TaskStage, output db.T
8485
}
8586

8687
end := strings.Index(line, "]")
88+
89+
if end == -1 {
90+
log.WithFields(log.Fields{
91+
"context": "ansible play parser",
92+
"line": line,
93+
}).Warn("Failed to parse failed task line")
94+
return
95+
}
96+
8797
p.state.CurrentTask = line[len(ansibleTaskMaker):end]
8898
p.state.CurrentFailedHost = ""
8999
p.state.CurrentHostAnswer = ""

0 commit comments

Comments
 (0)