Make sure that task group has a deployment state before using it

This commit is contained in:
Preetha Appan
2018-04-25 10:31:18 -05:00
parent ca588f9ce0
commit 0babfcc42c

View File

@@ -525,10 +525,11 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool {
// Final check to see if the deployment is complete is to ensure everything
// is healthy
if deploymentComplete && a.deployment != nil {
dstate := a.deployment.TaskGroups[group]
if dstate.HealthyAllocs < helper.IntMax(dstate.DesiredTotal, dstate.DesiredCanaries) || // Make sure we have enough healthy allocs
(dstate.DesiredCanaries > 0 && !dstate.Promoted) { // Make sure we are promoted if we have canaries
deploymentComplete = false
if dstate, ok := a.deployment.TaskGroups[group]; ok {
if dstate.HealthyAllocs < helper.IntMax(dstate.DesiredTotal, dstate.DesiredCanaries) || // Make sure we have enough healthy allocs
(dstate.DesiredCanaries > 0 && !dstate.Promoted) { // Make sure we are promoted if we have canaries
deploymentComplete = false
}
}
}