mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Improve parsing of job struct
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user