fix(dev): Fix panic in controller-only dev mode
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb8 pc=0x16626b0]
goroutine 1 [running]:
github.com/hashicorp/boundary/internal/cmd/commands/dev.(*Command).Run(0xc000b90000, {0xc00003e110, 0x1, 0x1})
github.com/hashicorp/boundary/internal/cmd/commands/dev/dev.go:484 +0x490
github.com/mitchellh/cli.(*CLI).Run(0xc0003323c0)
github.com/mitchellh/cli@v1.1.5/cli.go:262 +0x5f8
github.com/hashicorp/boundary/internal/cmd.RunCustom({0xc00003e100?, 0x60?, 0x0?}, 0x0?)
github.com/hashicorp/boundary/internal/cmd/main.go:189 +0xa16
github.com/hashicorp/boundary/internal/cmd.Run(...)
github.com/hashicorp/boundary/internal/cmd/main.go:95
main.main()
github.com/hashicorp/boundary/cmd/boundary/main.go:16 +0xc7
This commit is contained in:
1 parent
9a3006e42a
commit
95398d3b65
1 file changed
+13
-10
@@ -479,18 +479,21 @@ func (c *Command) Run(args []string) int {
|
||||
c.DevUnprivilegedPassword = c.flagUnprivilegedPassword
|
||||
c.DevTargetDefaultPort = c.flagTargetDefaultPort
|
||||
c.Config.Plugins.ExecutionDir = c.flagPluginExecutionDir
|
||||
c.Config.Worker.AuthStoragePath = c.flagWorkerAuthStorageDir
|
||||
|
||||
c.Config.Worker.RecordingStoragePath = c.flagWorkerRecordingStorageDir
|
||||
if c.Config.Worker.RecordingStoragePath == "" {
|
||||
// Create a temp dir for recording storage
|
||||
const pattern = "recordingstorage"
|
||||
c.Config.Worker.RecordingStoragePath, err = os.MkdirTemp("", pattern)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error creating storage temp dir: %w", err).Error())
|
||||
return base.CommandCliError
|
||||
if !c.flagControllerOnly {
|
||||
c.Config.Worker.AuthStoragePath = c.flagWorkerAuthStorageDir
|
||||
c.Config.Worker.RecordingStoragePath = c.flagWorkerRecordingStorageDir
|
||||
|
||||
if c.Config.Worker.RecordingStoragePath == "" {
|
||||
// Create a temp dir for recording storage
|
||||
const pattern = "recordingstorage"
|
||||
c.Config.Worker.RecordingStoragePath, err = os.MkdirTemp("", pattern)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error creating storage temp dir: %w", err).Error())
|
||||
return base.CommandCliError
|
||||
}
|
||||
c.ShutdownFuncs = append(c.ShutdownFuncs, func() error { return os.RemoveAll(c.Config.Worker.RecordingStoragePath) })
|
||||
}
|
||||
c.ShutdownFuncs = append(c.ShutdownFuncs, func() error { return os.RemoveAll(c.Config.Worker.RecordingStoragePath) })
|
||||
}
|
||||
|
||||
if c.flagIdSuffix != "" {
|
||||
|
||||
Reference in new issue
Block a user