forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elastic#7457 from jbudz/issues/7157
[build] Add data directory for plugins Former-commit-id: 62f258b
- Loading branch information
Showing
12 changed files
with
71 additions
and
22 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains 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 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 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 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 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,15 @@ | ||
import expect from 'expect.js'; | ||
import path from '../'; | ||
import { accessSync, R_OK} from 'fs'; | ||
|
||
describe('Default path finder', function () { | ||
it('should find a kibana.yml', () => { | ||
const configPath = path.getConfig(); | ||
expect(() => accessSync(configPath, R_OK)).to.not.throwError(); | ||
}); | ||
|
||
it('should find a data directory', () => { | ||
const dataPath = path.getData(); | ||
expect(() => accessSync(dataPath, R_OK)).to.not.throwError(); | ||
}); | ||
}); |
This file contains 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,32 @@ | ||
import { accessSync, R_OK} from 'fs'; | ||
import { find } from 'lodash'; | ||
import { fromRoot } from '../../utils'; | ||
|
||
const CONFIG_PATHS = [ | ||
process.env.CONFIG_PATH, | ||
fromRoot('config/kibana.yml'), | ||
'/etc/kibana/kibana.yml' | ||
].filter(Boolean); | ||
|
||
const DATA_PATHS = [ | ||
process.env.DATA_PATH, | ||
fromRoot('installedPlugins/.data'), | ||
'/var/lib/kibana' | ||
].filter(Boolean); | ||
|
||
function findFile(paths) { | ||
const availablePath = find(paths, configPath => { | ||
try { | ||
accessSync(configPath, R_OK); | ||
return true; | ||
} catch (e) { | ||
//Check the next path | ||
} | ||
}); | ||
return availablePath || paths[0]; | ||
} | ||
|
||
export default { | ||
getConfig: () => findFile(CONFIG_PATHS), | ||
getData: () => findFile(DATA_PATHS) | ||
}; |
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = function (grunt) { | ||
grunt.registerTask('_build:installedPlugins', function () { | ||
grunt.file.mkdir('build/kibana/installedPlugins'); | ||
grunt.file.mkdir('build/kibana/installedPlugins/.data'); | ||
}); | ||
}; |
This file contains 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 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 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 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