-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Move kibana-keystore from data/ to config/ #57856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
9443a0a
Move kibana-keystore from data/ to config/
jbudz f7c5772
Merge branch 'master' into mv/kibana-keystore
jbudz 4255fc3
Merge branch 'master' into mv/kibana-keystore
elasticmachine f327c59
Merge branch 'mv/kibana-keystore' of github.com:jbudz/kibana into mv/…
jbudz 909eaa5
add breaking changes
jbudz 625b9c3
Merge branch 'master' into mv/kibana-keystore
elasticmachine fc13d8f
Merge branch 'master' into mv/kibana-keystore
jbudz f6c5439
update comment
jbudz 2991ba2
Merge branch 'mv/kibana-keystore' of github.com:jbudz/kibana into mv/…
jbudz cd18ed8
Merge branch 'master' into mv/kibana-keystore
jbudz 02d35c3
Merge branch 'master' into mv/kibana-keystore
elasticmachine 027bda7
Merge branch 'master' into mv/kibana-keystore
elasticmachine e5f2190
Merge branch 'master' into mv/kibana-keystore
elasticmachine 105d100
Merge branch 'master' into mv/kibana-keystore
jbudz ba87e36
wip
jbudz d0ecba2
Merge branch 'master' into mv/kibana-keystore
jbudz bb887e9
fix docs
jbudz dd27fab
read from both keystore locations, write priority to non-deprecated
jbudz beee61f
Merge branch 'master' into mv/kibana-keystore
elasticmachine 6f7621e
Merge branch 'master' into mv/kibana-keystore
elasticmachine 30abff0
Merge branch 'master' into mv/kibana-keystore
elasticmachine 7edcc9d
Merge branch 'master' into mv/kibana-keystore
jbudz e6fb8e1
note data directory fallback
jbudz 3c36f55
add tests for get_keystore
jbudz ad92279
Merge branch 'mv/kibana-keystore' of github.com:jbudz/kibana into mv/…
jbudz 5dfce32
Merge branch 'master' into mv/kibana-keystore
jbudz bb6bc84
Merge branch 'master' into mv/kibana-keystore
elasticmachine 74ab52a
Merge branch 'master' into mv/kibana-keystore
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { existsSync } from 'fs'; | ||
| import { join } from 'path'; | ||
|
|
||
| import Logger from '../cli_plugin/lib/logger'; | ||
| import { getConfigDirectory, getDataPath } from '../core/server/path'; | ||
|
|
||
| export function getKeystore() { | ||
| const configKeystore = join(getConfigDirectory(), 'kibana.keystore'); | ||
| const dataKeystore = join(getDataPath(), 'kibana.keystore'); | ||
| let keystorePath = null; | ||
| if (existsSync(dataKeystore)) { | ||
| const logger = new Logger(); | ||
| logger.log( | ||
| `kibana.keystore located in the data folder is deprecated. Future versions will use the config folder.` | ||
| ); | ||
| keystorePath = dataKeystore; | ||
| } else { | ||
| keystorePath = configKeystore; | ||
| } | ||
| return keystorePath; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { getKeystore } from './get_keystore'; | ||
| import Logger from '../cli_plugin/lib/logger'; | ||
| import fs from 'fs'; | ||
| import sinon from 'sinon'; | ||
|
|
||
| describe('get_keystore', () => { | ||
| const sandbox = sinon.createSandbox(); | ||
|
|
||
| beforeEach(() => { | ||
| sandbox.stub(Logger.prototype, 'log'); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| sandbox.restore(); | ||
| }); | ||
|
|
||
| it('uses the config directory if there is no pre-existing keystore', () => { | ||
| sandbox.stub(fs, 'existsSync').returns(false); | ||
| expect(getKeystore()).toContain('config'); | ||
| expect(getKeystore()).not.toContain('data'); | ||
| }); | ||
|
|
||
| it('uses the data directory if there is a pre-existing keystore in the data directory', () => { | ||
| sandbox.stub(fs, 'existsSync').returns(true); | ||
| expect(getKeystore()).toContain('data'); | ||
| expect(getKeystore()).not.toContain('config'); | ||
| }); | ||
|
|
||
| it('logs a deprecation warning if the data directory is used', () => { | ||
| sandbox.stub(fs, 'existsSync').returns(true); | ||
| getKeystore(); | ||
| sandbox.assert.calledOnce(Logger.prototype.log); | ||
| sandbox.assert.calledWith( | ||
| Logger.prototype.log, | ||
| 'kibana.keystore located in the data folder is deprecated. Future versions will use the config folder.' | ||
| ); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.