Merge pull request #5259 from hashicorp/b-npe-scheduler

scheduler: fix NPE when deployment is nil, but placement is a canary
This commit is contained in:
Preetha 2019-01-28 20:23:47 -06:00 committed by GitHub
commit cf15a80aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -517,7 +517,7 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul
// If we are placing a canary and we found a match, add the canary
// to the deployment state object and mark it as a canary.
if missing.Canary() {
if missing.Canary() && s.deployment != nil {
if state, ok := s.deployment.TaskGroups[tg.Name]; ok {
state.PlacedCanaries = append(state.PlacedCanaries, alloc.ID)
}