Skip to content

Commit

Permalink
add non-empty string validation for datacenters
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzyfresh committed May 3, 2019
1 parent 01c267b commit de25a7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3382,6 +3382,12 @@ func (j *Job) Validate() error {
}
if len(j.Datacenters) == 0 {
mErr.Errors = append(mErr.Errors, errors.New("Missing job datacenters"))
} else {
for _, v := range j.Datacenters {
if v == "" {
mErr.Errors = append(mErr.Errors, errors.New("Job datacenter must be non-empty string"))
}
}
}
if len(j.TaskGroups) == 0 {
mErr.Errors = append(mErr.Errors, errors.New("Missing job task groups"))
Expand Down

0 comments on commit de25a7b

Please sign in to comment.