Making sure a Task Group has a restart policy

This commit is contained in:
Diptanu Choudhury
2015-11-11 15:10:39 -08:00
parent fbabd1237b
commit d03f9cd217

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