mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
VAULT-22030 update error message when from entity isn't found as part of automated entity merge (#24188)
* VAULT-22030 update error message when from entity isn't found as part of automated entity merge * VAULT-22030 add extra info
This commit is contained in:
@@ -883,6 +883,15 @@ func (i *IdentityStore) mergeEntity(ctx context.Context, txn *memdb.Txn, toEntit
|
||||
}
|
||||
|
||||
if fromEntity == nil {
|
||||
// If forceMergeAliases is true, and we didn't find a fromEntity, then something
|
||||
// is wrong with storage. This function was called as part of an automated
|
||||
// merge from CreateOrFetchEntity or Invalidate to repatriate an alias with its 'true'
|
||||
// entity. As a result, the entity _should_ exist, but we can't find it.
|
||||
// MemDb may be in a bad state, because fromEntity should be non-nil in the
|
||||
// automated merge case.
|
||||
if forceMergeAliases {
|
||||
return fmt.Errorf("fromEntity %s was not found in memdb as part of an automated entity merge into %s; storage/memdb may be in a bad state", fromEntityID, toEntity.ID), nil, nil
|
||||
}
|
||||
return errors.New("entity id to merge from is invalid"), nil, nil
|
||||
}
|
||||
|
||||
@@ -995,6 +1004,15 @@ func (i *IdentityStore) mergeEntity(ctx context.Context, txn *memdb.Txn, toEntit
|
||||
}
|
||||
|
||||
if fromEntity == nil {
|
||||
// If forceMergeAliases is true, and we didn't find a fromEntity, then something
|
||||
// is wrong with storage. This function was called as part of an automated
|
||||
// merge from CreateOrFetchEntity or Invalidate to repatriate an alias with its 'true'
|
||||
// entity. As a result, the entity _should_ exist, but we can't find it.
|
||||
// MemDb may be in a bad state, because fromEntity should be non-nil in the
|
||||
// automated merge case.
|
||||
if forceMergeAliases {
|
||||
return fmt.Errorf("fromEntity %s was not found in memdb as part of an automated entity merge into %s; storage/memdb may be in a bad state", fromEntityID, toEntity.ID), nil, nil
|
||||
}
|
||||
return errors.New("entity id to merge from is invalid"), nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user