Skip to content

Commit

Permalink
fix panic while deleting CSI plugins for missing job
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldwan committed Apr 20, 2020
1 parent 71744bc commit 3785251
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions nomad/state/state_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,15 +1187,14 @@ func (s *StateStore) deleteJobFromPlugin(index uint64, txn *memdb.Txn, job *stru
plugins := map[string]*structs.CSIPlugin{}

for _, a := range allocs {
tg := job.LookupTaskGroup(a.TaskGroup)
// if its nil, we can just panic
for _, t := range tg.Tasks {
if t.CSIPluginConfig != nil {
plugAllocs = append(plugAllocs, &pair{
pluginID: t.CSIPluginConfig.ID,
alloc: a,
})

if tg := job.LookupTaskGroup(a.TaskGroup); tg != nil {
for _, t := range tg.Tasks {
if t.CSIPluginConfig != nil {
plugAllocs = append(plugAllocs, &pair{
pluginID: t.CSIPluginConfig.ID,
alloc: a,
})
}
}
}
}
Expand Down

0 comments on commit 3785251

Please sign in to comment.