server: Add back controller shutdown on worker startup failure (#1432)
* server: Add back controller shutdown on worker startup failure
This adds back the controller shutdown call on worker failure.
This was added in a15961e4 to address a panic discovered in testing, and
was mistakenly thought to be unnecessary. This, however, covers
multi-role scenarios where we have already started the controller, which
needs to be shut down gracefully if possible if we can't start the
worker.
A nil check has been added to ensure the panic does not resurface.
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
1 parent
8599b55f7a
commit
947dc96b30
2 files changed
+8
No files matched your search
@@ -102,6 +102,9 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
|
||||
well as the error message)
|
||||
([issue](https://github.com/hashicorp/boundary/issues/1305),
|
||||
[PR](https://github.com/hashicorp/boundary/pull/1384))
|
||||
* server: Fix panic on worker startup failure when the server was not also
|
||||
configured as a controller
|
||||
([PR](https://github.com/hashicorp/boundary/pull/1432))
|
||||
|
||||
### New and Improved
|
||||
|
||||
|
||||
@@ -463,6 +463,11 @@ func (c *Command) Run(args []string) int {
|
||||
if c.Config.Worker != nil {
|
||||
if err := c.StartWorker(); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
if c.controller != nil {
|
||||
if err := c.controller.Shutdown(false); err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error with controller shutdown: %w", err).Error())
|
||||
}
|
||||
}
|
||||
return base.CommandCliError
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user