Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Adjust extend_es_archiver to handle additional cases (elastic#79308) (e…
Browse files Browse the repository at this point in the history
…lastic#79335)

This PR enables the extend_es_archiver to recognize additional indices like .kibana_1 as well as a list of indices.
  • Loading branch information
pheyos authored Oct 2, 2020
1 parent 9c99876 commit 76f31d5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/common/services/kibana_server/extend_es_archiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ export function extendEsArchiver({ esArchiver, kibanaServer, retry, defaults })
// esArchiver methods return a stats object, with information about the indexes created
const stats = await originalMethod.apply(esArchiver, args);

const statsKeys = Object.keys(stats);
const kibanaKeys = statsKeys.filter(
// this also matches stats keys like '.kibana_1' and '.kibana_2,.kibana_1'
(key) => key.includes(KIBANA_INDEX) && (stats[key].created || stats[key].deleted)
);

// if the kibana index was created by the esArchiver then update the uiSettings
// with the defaults to make sure that they are always in place initially
if (stats[KIBANA_INDEX] && (stats[KIBANA_INDEX].created || stats[KIBANA_INDEX].deleted)) {
if (kibanaKeys.length > 0) {
await retry.try(async () => {
await kibanaServer.uiSettings.update(defaults);
});
Expand Down

0 comments on commit 76f31d5

Please sign in to comment.