cli: fix panic on job restart (#17346)
When monitoring the replacement allocation, if the `Allocations().Info()` request fails, the `alloc` variable is `nil`, so it should not be read.
This commit is contained in:
parent
bb2395031b
commit
e236d6dedd
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
cli: Fix a panic in the `nomad job restart` command when monitoring replacement allocations
|
||||||
|
```
|
|
@ -1045,7 +1045,7 @@ func (c *JobRestartCommand) monitorReplacementAlloc(
|
||||||
|
|
||||||
alloc, qm, err := c.client.Allocations().Info(currentAllocID, q)
|
alloc, qm, err := c.client.Allocations().Info(currentAllocID, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errCh <- fmt.Errorf("Failed to retrieve allocation %q: %w", limit(alloc.ID, c.length), err)
|
errCh <- fmt.Errorf("Failed to retrieve allocation %q: %w", limit(currentAllocID, c.length), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue