From d0441e1fee646f8dbb1fcddb07105023402a36dd Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 17 Nov 2020 09:19:46 -0600 Subject: [PATCH] Move src/legacy/server/keystore to src/cli (#83483) Currently keystore parsing is in the legacy http server folder. Keystore references end in src/cli so instead of migrating to core/server the I opted for the closest fit in the CLI folder. Closes #52107 --- .github/CODEOWNERS | 2 +- src/{legacy/server => cli}/keystore/errors.js | 0 src/{legacy/server => cli}/keystore/index.js | 0 src/{legacy/server => cli}/keystore/keystore.js | 0 src/{legacy/server => cli}/keystore/keystore.test.js | 0 src/cli/{serve => keystore}/read_keystore.js | 2 +- src/cli/{serve => keystore}/read_keystore.test.js | 4 ++-- src/cli/serve/serve.js | 2 +- src/cli_keystore/add.test.js | 2 +- src/cli_keystore/cli_keystore.js | 2 +- src/cli_keystore/create.test.js | 2 +- src/cli_keystore/list.test.js | 2 +- src/cli_keystore/remove.test.js | 2 +- 13 files changed, 10 insertions(+), 10 deletions(-) rename src/{legacy/server => cli}/keystore/errors.js (100%) rename src/{legacy/server => cli}/keystore/index.js (100%) rename src/{legacy/server => cli}/keystore/keystore.js (100%) rename src/{legacy/server => cli}/keystore/keystore.test.js (100%) rename src/cli/{serve => keystore}/read_keystore.js (95%) rename src/cli/{serve => keystore}/read_keystore.test.js (94%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b7fb3ff04db71..af010089e4892 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -158,7 +158,7 @@ /packages/kbn-ui-shared-deps/ @elastic/kibana-operations /packages/kbn-es-archiver/ @elastic/kibana-operations /packages/kbn-utils/ @elastic/kibana-operations -/src/legacy/server/keystore/ @elastic/kibana-operations +/src/cli/keystore/ @elastic/kibana-operations /src/legacy/server/warnings/ @elastic/kibana-operations /.ci/es-snapshots/ @elastic/kibana-operations /vars/ @elastic/kibana-operations diff --git a/src/legacy/server/keystore/errors.js b/src/cli/keystore/errors.js similarity index 100% rename from src/legacy/server/keystore/errors.js rename to src/cli/keystore/errors.js diff --git a/src/legacy/server/keystore/index.js b/src/cli/keystore/index.js similarity index 100% rename from src/legacy/server/keystore/index.js rename to src/cli/keystore/index.js diff --git a/src/legacy/server/keystore/keystore.js b/src/cli/keystore/keystore.js similarity index 100% rename from src/legacy/server/keystore/keystore.js rename to src/cli/keystore/keystore.js diff --git a/src/legacy/server/keystore/keystore.test.js b/src/cli/keystore/keystore.test.js similarity index 100% rename from src/legacy/server/keystore/keystore.test.js rename to src/cli/keystore/keystore.test.js diff --git a/src/cli/serve/read_keystore.js b/src/cli/keystore/read_keystore.js similarity index 95% rename from src/cli/serve/read_keystore.js rename to src/cli/keystore/read_keystore.js index 38d0e68bd5c4e..b3bca4cf11c39 100644 --- a/src/cli/serve/read_keystore.js +++ b/src/cli/keystore/read_keystore.js @@ -19,7 +19,7 @@ import { set } from '@elastic/safer-lodash-set'; -import { Keystore } from '../../legacy/server/keystore'; +import { Keystore } from '../keystore'; import { getKeystore } from '../../cli_keystore/get_keystore'; export function readKeystore(keystorePath = getKeystore()) { diff --git a/src/cli/serve/read_keystore.test.js b/src/cli/keystore/read_keystore.test.js similarity index 94% rename from src/cli/serve/read_keystore.test.js rename to src/cli/keystore/read_keystore.test.js index e5407b257a909..a35258febfb8e 100644 --- a/src/cli/serve/read_keystore.test.js +++ b/src/cli/keystore/read_keystore.test.js @@ -20,8 +20,8 @@ import path from 'path'; import { readKeystore } from './read_keystore'; -jest.mock('../../legacy/server/keystore'); -import { Keystore } from '../../legacy/server/keystore'; +jest.mock('../keystore'); +import { Keystore } from '../keystore'; describe('cli/serve/read_keystore', () => { beforeEach(() => { diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js index a1715cf3dba2c..f344d3b70ed9d 100644 --- a/src/cli/serve/serve.js +++ b/src/cli/serve/serve.js @@ -27,7 +27,7 @@ import { getConfigPath } from '@kbn/utils'; import { IS_KIBANA_DISTRIBUTABLE } from '../../legacy/utils'; import { fromRoot } from '../../core/server/utils'; import { bootstrap } from '../../core/server'; -import { readKeystore } from './read_keystore'; +import { readKeystore } from '../keystore/read_keystore'; function canRequire(path) { try { diff --git a/src/cli_keystore/add.test.js b/src/cli_keystore/add.test.js index ba381ca2f3e14..74a72fe44d398 100644 --- a/src/cli_keystore/add.test.js +++ b/src/cli_keystore/add.test.js @@ -39,7 +39,7 @@ jest.mock('fs', () => ({ import sinon from 'sinon'; import { PassThrough } from 'stream'; -import { Keystore } from '../legacy/server/keystore'; +import { Keystore } from '../cli/keystore'; import { add } from './add'; import { Logger } from '../cli_plugin/lib/logger'; import * as prompt from './utils/prompt'; diff --git a/src/cli_keystore/cli_keystore.js b/src/cli_keystore/cli_keystore.js index d12c80b361c92..9fbea8f195122 100644 --- a/src/cli_keystore/cli_keystore.js +++ b/src/cli_keystore/cli_keystore.js @@ -21,7 +21,7 @@ import _ from 'lodash'; import { pkg } from '../core/server/utils'; import Command from '../cli/command'; -import { Keystore } from '../legacy/server/keystore'; +import { Keystore } from '../cli/keystore'; import { createCli } from './create'; import { listCli } from './list'; diff --git a/src/cli_keystore/create.test.js b/src/cli_keystore/create.test.js index cb85475eab1cb..346fa9e055129 100644 --- a/src/cli_keystore/create.test.js +++ b/src/cli_keystore/create.test.js @@ -38,7 +38,7 @@ jest.mock('fs', () => ({ import sinon from 'sinon'; -import { Keystore } from '../legacy/server/keystore'; +import { Keystore } from '../cli/keystore'; import { create } from './create'; import { Logger } from '../cli_plugin/lib/logger'; import * as prompt from './utils/prompt'; diff --git a/src/cli_keystore/list.test.js b/src/cli_keystore/list.test.js index 11c474f908216..8da235a1932e6 100644 --- a/src/cli_keystore/list.test.js +++ b/src/cli_keystore/list.test.js @@ -36,7 +36,7 @@ jest.mock('fs', () => ({ })); import sinon from 'sinon'; -import { Keystore } from '../legacy/server/keystore'; +import { Keystore } from '../cli//keystore'; import { list } from './list'; import { Logger } from '../cli_plugin/lib/logger'; diff --git a/src/cli_keystore/remove.test.js b/src/cli_keystore/remove.test.js index fae8924c67287..fb700e6a8b9e2 100644 --- a/src/cli_keystore/remove.test.js +++ b/src/cli_keystore/remove.test.js @@ -30,7 +30,7 @@ jest.mock('fs', () => ({ import sinon from 'sinon'; -import { Keystore } from '../legacy/server/keystore'; +import { Keystore } from '../cli/keystore'; import { remove } from './remove'; describe('Kibana keystore', () => {