Unverified Commit 8ac47f5b authored by hc-github-team-nomad-core's avatar hc-github-team-nomad-core Committed by GitHub
Browse files

Merge pull request #12661 from...

Merge pull request #12661 from hashicorp/backport/csi-tolerate-nil-plugin-on-job-delete/centrally-helped-seasnail

This pull request was automerged via backport-assistant
parents 9e12e617 889601b3
Showing with 10 additions and 3 deletions
+10 -3
```release-note:bug
csi: Fixed a bug where purging a job with a missing plugin would fail
```
......@@ -1420,7 +1420,9 @@ func (s *StateStore) deleteJobFromPlugins(index uint64, txn Txn, job *structs.Jo
return fmt.Errorf("error getting plugin: %s, %v", x.pluginID, err)
}
if plug == nil {
return fmt.Errorf("plugin missing: %s %v", x.pluginID, err)
// plugin was never successfully registered or has been
// GC'd out from under us
continue
}
// only copy once, so we update the same plugin on each alloc
plugins[x.pluginID] = plug.Copy()
......@@ -1444,8 +1446,10 @@ func (s *StateStore) deleteJobFromPlugins(index uint64, txn Txn, job *structs.Jo
}
}
if err = txn.Insert("index", &IndexEntry{"csi_plugins", index}); err != nil {
return fmt.Errorf("index update failed: %v", err)
if len(plugins) > 0 {
if err = txn.Insert("index", &IndexEntry{"csi_plugins", index}); err != nil {
return fmt.Errorf("index update failed: %v", err)
}
}
return nil
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment