Commit a65e5b64 authored by galal-hussein's avatar galal-hussein

Fix multiple bootstrap keys found

parent 37fcb61f
......@@ -132,20 +132,21 @@ func (c *Cluster) getBootstrapKeyFromStorage(ctx context.Context, storageClient
return nil, false, nil
}
if len(bootstrapList) > 1 {
return nil, false, errors.New("found multiple bootstrap keys in storage")
logrus.Warn("found multiple bootstrap keys in storage")
}
bootstrapKV := bootstrapList[0]
// checking for empty string bootstrap key
switch string(bootstrapKV.Key) {
case emptyStringKey:
logrus.Warn("bootstrap data encrypted with empty string, deleting and resaving with token")
c.saveBootstrap = true
if err := storageClient.Delete(ctx, emptyStringKey, bootstrapKV.Modified); err != nil {
return nil, false, err
for _, bootstrapKV := range bootstrapList {
// checking for empty string bootstrap key
switch string(bootstrapKV.Key) {
case emptyStringKey:
logrus.Warn("bootstrap data encrypted with empty string, deleting and resaving with token")
c.saveBootstrap = true
if err := storageClient.Delete(ctx, emptyStringKey, bootstrapKV.Modified); err != nil {
return nil, false, err
}
return &bootstrapKV, true, nil
case tokenKey:
return &bootstrapKV, false, nil
}
return &bootstrapKV, true, nil
case tokenKey:
return &bootstrapKV, false, nil
}
return nil, false, errors.New("bootstrap data already found and encrypted with different token")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment