Only set deployment health if not already set

This commit is contained in:
Preetha Appan
2019-01-11 08:49:31 -06:00
parent a20ae598c7
commit 032ec425c2

View File

@@ -1987,9 +1987,14 @@ func makeFailedAlloc(add *structs.Allocation, err error) *structs.Allocation {
}
failTime := time.Now()
stripped.DeploymentStatus = &structs.AllocDeploymentStatus{
Healthy: helper.BoolToPtr(false),
Timestamp: failTime,
if add.DeploymentStatus.HasHealth() {
// Never change deployment health once it has been set
stripped.DeploymentStatus = add.DeploymentStatus.Copy()
} else {
stripped.DeploymentStatus = &structs.AllocDeploymentStatus{
Healthy: helper.BoolToPtr(false),
Timestamp: failTime,
}
}
taskGroup := add.Job.LookupTaskGroup(add.TaskGroup)