Skip to content

Commit

Permalink
Setting Elasticsearch plugin to yellow instead of Kibana plugin
Browse files Browse the repository at this point in the history
The Elasticsearch plugin is what is responsible for (re)creating the Kibana index. So it makes sense that if we couldn't find the user settings in that index, we set the Elasticsearch plugin to yellow. Once it recreates the Kibana index, it will set itself to green. No need to toggle the states of the Kibana plugin at all.
  • Loading branch information
ycombinator committed Jun 14, 2016
1 parent a81d759 commit 777ebbc
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/ui/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,16 @@ export default function setupSettings(kbnServer, server, config) {
}

function userSettingsNotFound(kibanaVersion) {
server.plugins.kibana.status.yellow(`Could not find user-provided settings for this version of Kibana (${kibanaVersion})`);
server.plugins.elasticsearch.status.yellow(`Could not find user-provided settings for this version of Kibana (${kibanaVersion})`);
return {};
}

function resetKibanaPluginStatusIfNecessary(user) {
const isElasticsearchPluginGreen = server.plugins.elasticsearch.status.state === 'green';
const isKibanaPluginCurrentlyYellow = server.plugins.kibana.status.state === 'yellow';
if (isElasticsearchPluginGreen && isKibanaPluginCurrentlyYellow) {
server.plugins.kibana.status.green('Ready');
}
return user;
}

function getUserProvided() {
const { client } = server.plugins.elasticsearch;
const clientSettings = getClientSettings(config);
return client
.get({ ...clientSettings })
.then(res => res._source)
.then(resetKibanaPluginStatusIfNecessary)
.catch(partial(userSettingsNotFound, clientSettings.id))
.then(user => hydrateUserSettings(user));
}
Expand Down

0 comments on commit 777ebbc

Please sign in to comment.