mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Co-authored-by: Esteban Beltran <academo@users.noreply.github.com>
This commit is contained in:
parent
0f46bdc18b
commit
6160a15eb0
3 changed files with 20 additions and 3 deletions
|
@ -194,11 +194,23 @@ exports.Artifact = class Artifact {
|
|||
* @param {string} dest
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async download(dest) {
|
||||
async download(dest, { useCached = false }) {
|
||||
await retry(this._log, async () => {
|
||||
const cacheMeta = cache.readMeta(dest);
|
||||
const tmpPath = `${dest}.tmp`;
|
||||
|
||||
if (useCached) {
|
||||
if (cacheMeta.exists) {
|
||||
this._log.info(
|
||||
'use-cached passed, forcing to use existing snapshot',
|
||||
chalk.bold(cacheMeta.ts)
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
this._log.info('use-cached passed but no cached snapshot found. Continuing to download');
|
||||
}
|
||||
}
|
||||
|
||||
const artifactResp = await this._download(tmpPath, cacheMeta.etag, cacheMeta.ts);
|
||||
if (artifactResp.cached) {
|
||||
return;
|
||||
|
|
|
@ -29,6 +29,7 @@ exports.help = (defaults = {}) => {
|
|||
-E Additional key=value settings to pass to Elasticsearch
|
||||
--download-only Download the snapshot but don't actually start it
|
||||
--ssl Sets up SSL on Elasticsearch
|
||||
--use-cached Skips cache verification and use cached ES snapshot.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -51,11 +52,12 @@ exports.run = async (defaults = {}) => {
|
|||
installPath: 'install-path',
|
||||
dataArchive: 'data-archive',
|
||||
esArgs: 'E',
|
||||
useCached: 'use-cached',
|
||||
},
|
||||
|
||||
string: ['version'],
|
||||
|
||||
boolean: ['download-only'],
|
||||
boolean: ['download-only', 'use-cached'],
|
||||
|
||||
default: defaults,
|
||||
});
|
||||
|
|
|
@ -29,6 +29,7 @@ exports.downloadSnapshot = async function installSnapshot({
|
|||
basePath = BASE_PATH,
|
||||
installPath = path.resolve(basePath, version),
|
||||
log = defaultLog,
|
||||
useCached = false,
|
||||
}) {
|
||||
log.info('version: %s', chalk.bold(version));
|
||||
log.info('install path: %s', chalk.bold(installPath));
|
||||
|
@ -36,7 +37,7 @@ exports.downloadSnapshot = async function installSnapshot({
|
|||
|
||||
const artifact = await Artifact.getSnapshot(license, version, log);
|
||||
const dest = path.resolve(basePath, 'cache', artifact.getFilename());
|
||||
await artifact.download(dest);
|
||||
await artifact.download(dest, { useCached });
|
||||
|
||||
return {
|
||||
downloadPath: dest,
|
||||
|
@ -62,6 +63,7 @@ exports.installSnapshot = async function installSnapshot({
|
|||
installPath = path.resolve(basePath, version),
|
||||
log = defaultLog,
|
||||
esArgs,
|
||||
useCached = false,
|
||||
}) {
|
||||
const { downloadPath } = await exports.downloadSnapshot({
|
||||
license,
|
||||
|
@ -69,6 +71,7 @@ exports.installSnapshot = async function installSnapshot({
|
|||
basePath,
|
||||
installPath,
|
||||
log,
|
||||
useCached,
|
||||
});
|
||||
|
||||
return await installArchive(downloadPath, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue