Skip to content

Commit

Permalink
Merge pull request #2030 from gliptak/missingname1
Browse files Browse the repository at this point in the history
Improve parsing of job struct
  • Loading branch information
dadgar committed Nov 28, 2016
2 parents 0ed5967 + 0427706 commit 3537922
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jobspec/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ func ParseFile(path string) (*structs.Job, error) {
}

func parseJob(result *structs.Job, list *ast.ObjectList) error {
list = list.Children()
if len(list.Items) != 1 {
return fmt.Errorf("only one 'job' block allowed")
}
list = list.Children()
if len(list.Items) != 1 {
return fmt.Errorf("'job' block missing name")
}

// Get our job object
obj := list.Items[0]
Expand Down

0 comments on commit 3537922

Please sign in to comment.