Skip to content

Commit

Permalink
FAB-17752: return errors when creating keystore
Browse files Browse the repository at this point in the history
Signed-off-by: Shitaibin <hz_stb@163.com>
Change-Id: I9e68f2c79eb38e7c38e5903080309c762f6cb6bf
  • Loading branch information
Shitaibin authored and denyeart committed Apr 19, 2020
1 parent 2f740c4 commit c403374
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bccsp/sw/fileks.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,7 @@ func (ks *fileBasedKeyStore) createKeyStoreIfNotExists() error {
if missing {
logger.Debugf("KeyStore path [%s] missing [%t]: [%s]", ksPath, missing, utils.ErrToString(err))

err := ks.createKeyStore()
if err != nil {
logger.Errorf("Failed creating KeyStore At [%s]: [%s]", ksPath, err.Error())
return nil
}
return ks.createKeyStore()
}

return nil
Expand All @@ -411,20 +407,24 @@ func (ks *fileBasedKeyStore) createKeyStoreIfNotExists() error {
func (ks *fileBasedKeyStore) createKeyStore() error {
// Create keystore directory root if it doesn't exist yet
ksPath := ks.path
logger.Debugf("Creating KeyStore at [%s]...", ksPath)
logger.Debugf("Creating KeyStore at [%s]", ksPath)

os.MkdirAll(ksPath, 0755)
err := os.MkdirAll(ksPath, 0755)
if err == nil {
logger.Debugf("KeyStore created at [%s]", ksPath)
} else {
logger.Errorf("Failed creating KeyStore at [%s]: [%s]", ksPath, err.Error())
}

logger.Debugf("KeyStore created at [%s].", ksPath)
return nil
return err
}

func (ks *fileBasedKeyStore) openKeyStore() error {
if ks.isOpen {
return nil
}
ks.isOpen = true
logger.Debugf("KeyStore opened at [%s]...done", ks.path)
logger.Debugf("KeyStore opened at [%s]", ks.path)

return nil
}
Expand Down

0 comments on commit c403374

Please sign in to comment.