Skip to content

Commit

Permalink
Improve parsing of job struct
Browse files Browse the repository at this point in the history
  • Loading branch information
gliptak committed Nov 24, 2016
1 parent 3e63908 commit 0427706
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 0427706

Please sign in to comment.