Skip to content

Commit

Permalink
Safety guard
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Apr 25, 2018
1 parent 9a245b1 commit 8ca8484
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nomad/drainer/draining_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func (n *drainingNode) DrainingJobs() ([]structs.NamespacedID, error) {
n.l.RLock()
defer n.l.RUnlock()

// Should never happen
if n.node == nil || n.node.DrainStrategy == nil {
return nil, fmt.Errorf("node doesn't have a drain strategy set")
}

// Retrieve the allocs on the node
allocs, err := n.state.AllocsByNode(nil, n.node.ID)
if err != nil {
Expand Down

0 comments on commit 8ca8484

Please sign in to comment.