Merge pull request #7333 from ycombinator/gh-7318

If user settings cannot be found for installed version of Kibana, turn Kibana plugin red
This commit is contained in:
Shaunak Kashyap 2016-06-02 10:16:52 -05:00
commit 6e46c0e798

View file

@ -1,4 +1,4 @@
import { defaultsDeep } from 'lodash';
import { defaultsDeep, partial } from 'lodash';
import defaultsProvider from './defaults';
export default function setupSettings(kbnServer, server, config) {
@ -23,12 +23,19 @@ export default function setupSettings(kbnServer, server, config) {
return Promise.resolve(defaultsProvider());
}
function userSettingsNotFound(kibanaVersion) {
const message = 'Could not find user-provided settings for this version of Kibana (' + kibanaVersion + ')';
server.plugins.kibana.status.red(message);
return {};
}
function getUserProvided() {
const { client } = server.plugins.elasticsearch;
const clientSettings = getClientSettings(config);
return client
.get({ ...clientSettings })
.then(res => res._source)
.catch(partial(userSettingsNotFound, clientSettings.id))
.then(user => hydrateUserSettings(user));
}