Skip to content

Commit

Permalink
[Upgrade Assistant] Minimize reindex attributes used to create creden…
Browse files Browse the repository at this point in the history
…tial hash (#123727) (#123864) (#123925)

(cherry picked from commit 94e64e4)
  • Loading branch information
alisonelizabeth committed Jan 27, 2022
1 parent 2d12a9d commit 96fea80
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ import { ReindexSavedObject, ReindexStatus } from '../../../common/types';
export type Credential = Record<string, any>;

// Generates a stable hash for the reindex operation's current state.
const getHash = (reindexOp: ReindexSavedObject) =>
createHash('sha256')
.update(stringify({ id: reindexOp.id, ...reindexOp.attributes }))
const getHash = (reindexOp: ReindexSavedObject) => {
// Remove reindexOptions from the SO attributes as it creates an unstable hash
// This needs further investigation, see: https://github.com/elastic/kibana/issues/123752
const { reindexOptions, ...attributes } = reindexOp.attributes;
return createHash('sha256')
.update(stringify({ id: reindexOp.id, ...attributes }))
.digest('base64');
};

// Returns a base64-encoded API key string or undefined
const getApiKey = async ({
Expand Down

0 comments on commit 96fea80

Please sign in to comment.