Minor ports

This commit is contained in:
Jeff Mitchell 2016-12-05 12:28:12 -05:00
parent 710e8f2d4c
commit 7865143c1d
3 changed files with 15 additions and 4 deletions

View File

@ -206,12 +206,19 @@ func (c *ServerCommand) Run(args []string) int {
// Ensure that the seal finalizer is called, even if using verify-only
defer func() {
err = seal.Finalize()
if err != nil {
c.Ui.Output(fmt.Sprintf("Error finalizing seals: %v", err))
if seal != nil {
err = seal.Finalize()
if err != nil {
c.Ui.Output(fmt.Sprintf("Error finalizing seals: %v", err))
}
}
}()
if seal == nil {
c.Ui.Error(fmt.Sprintf("Could not create seal"))
return 1
}
coreConfig := &vault.CoreConfig{
Physical: backend,
RedirectAddr: config.Backend.RedirectAddr,

View File

@ -15,7 +15,7 @@ func TestCore_Init(t *testing.T) {
c, conf := testCore_NewTestCore(t, nil)
testCore_Init_Common(t, c, conf, &SealConfig{SecretShares: 5, SecretThreshold: 3}, nil)
c, conf = testCore_NewTestCore(t, &TestSeal{})
c, conf = testCore_NewTestCore(t, newTestSeal(t))
bc, rc := TestSealDefConfigs()
rc.SecretShares = 4
rc.SecretThreshold = 2

View File

@ -15,6 +15,10 @@ type TestSeal struct {
recoveryConfig *SealConfig
}
func newTestSeal(t *testing.T) Seal {
return &TestSeal{}
}
func (d *TestSeal) checkCore() error {
if d.defseal.core == nil {
return fmt.Errorf("seal does not have a core set")