Skip to content

Commit

Permalink
verify job.Type isn't nil before continuing
Browse files Browse the repository at this point in the history
  The switch will still lead to a SEGV as the dereference is to a nil
  pointer. First verify that job.Type isn't nil.
  • Loading branch information
Yorick Gersie committed Nov 14, 2017
1 parent f013954 commit d17d302
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions levant/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ func (c *nomadClient) Deploy(job *nomad.Job, autoPromote int) (success bool) {
return
}

// If job.Type isn't set we can't continue
if job.Type == nil {
logging.Error("levant/deploy: Nomad job `type` is not set. Should be set to `service`")
return
}

logging.Debug("levant/deploy: running dynamic job count updater for job %s", *job.Name)
if err := c.dynamicGroupCountUpdater(job); err != nil {
return
Expand Down

0 comments on commit d17d302

Please sign in to comment.