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
  • Loading branch information
alisonelizabeth authored Jan 27, 2022
1 parent 481fb8f commit 94e64e4
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 94e64e4

Please sign in to comment.