Merge pull request #409 from hashicorp/b-restart-policy-validation

Making sure a Task Group has a restart policy
This commit is contained in:
Alex Dadgar 2015-11-11 16:29:46 -08:00
commit d22a2fa813

View file

@ -979,8 +979,12 @@ func (tg *TaskGroup) Validate() error {
}
}
if err := tg.RestartPolicy.Validate(); err != nil {
mErr.Errors = append(mErr.Errors, err)
if tg.RestartPolicy != nil {
if err := tg.RestartPolicy.Validate(); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
} else {
mErr.Errors = append(mErr.Errors, fmt.Errorf("Task Group %v should have a restart policy", tg.Name))
}
// Check for duplicate tasks