Skip to content

Commit

Permalink
Remove LP deprecations (#76536) (#76749)
Browse files Browse the repository at this point in the history
* inline deprecations in kbn-test

* remove LP deprecations

* remove test

* inline log call

* remove unnecessary deprecations for the test config
  • Loading branch information
mshustov authored Sep 4, 2020
1 parent e8c41b3 commit 19b212d
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 555 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { ToolingLog } from '@kbn/dev-utils';
import { defaultsDeep } from 'lodash';

import { Config } from './config';
import { transformDeprecations } from './transform_deprecations';

const cache = new WeakMap();

Expand Down Expand Up @@ -52,8 +51,7 @@ async function getSettingsFromFile(log: ToolingLog, path: string, settingOverrid
await cache.get(configProvider)!
);

const logDeprecation = (error: string | Error) => log.error(error);
return transformDeprecations(settingsWithDefaults, logDeprecation);
return settingsWithDefaults;
}

export async function readConfigFile(log: ToolingLog, path: string, settingOverrides: any = {}) {
Expand Down

This file was deleted.

30 changes: 0 additions & 30 deletions src/core/server/legacy/config/get_unused_config_keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,34 +217,4 @@ describe('getUnusedConfigKeys', () => {
})
).toEqual([]);
});

describe('using deprecation', () => {
it('should use the plugin deprecations provider', async () => {
expect(
await getUnusedConfigKeys({
coreHandledConfigPaths: [],
pluginSpecs: [
({
getDeprecationsProvider() {
return async ({ rename }: any) => [rename('foo1', 'foo2')];
},
getConfigPrefix: () => 'foo',
} as unknown) as LegacyPluginSpec,
],
disabledPluginSpecs: [],
settings: {
foo: {
foo: 'dolly',
foo1: 'bar',
},
},
legacyConfig: getConfig({
foo: {
foo2: 'bar',
},
}),
})
).toEqual(['foo.foo']);
});
});
});
20 changes: 1 addition & 19 deletions src/core/server/legacy/config/get_unused_config_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
* under the License.
*/

import { set } from '@elastic/safer-lodash-set';
import { difference, get } from 'lodash';
// @ts-expect-error
import { getTransform } from '../../../../legacy/deprecation/index';
import { difference } from 'lodash';
import { unset } from '../../../../legacy/utils';
import { getFlattenedObject } from '../../../utils';
import { hasConfigPathIntersection } from '../../config';
Expand All @@ -41,21 +38,6 @@ export async function getUnusedConfigKeys({
settings: LegacyVars;
legacyConfig: LegacyConfig;
}) {
// transform deprecated plugin settings
for (let i = 0; i < pluginSpecs.length; i++) {
const spec = pluginSpecs[i];
const transform = await getTransform(spec);
const prefix = spec.getConfigPrefix();

// nested plugin prefixes (a.b) translate to nested objects
const pluginSettings = get(settings, prefix);
if (pluginSettings) {
// flattened settings are expected to be converted to nested objects
// a.b = true => { a: { b: true }}
set(settings, prefix, transform(pluginSettings));
}
}

// remove config values from disabled plugins
for (const spec of disabledPluginSpecs) {
unset(settings, spec.getConfigPrefix());
Expand Down
59 changes: 0 additions & 59 deletions src/legacy/deprecation/__tests__/create_transform.js

This file was deleted.

33 changes: 0 additions & 33 deletions src/legacy/deprecation/create_transform.js

This file was deleted.

83 changes: 0 additions & 83 deletions src/legacy/deprecation/deprecations/__tests__/rename.js

This file was deleted.

76 changes: 0 additions & 76 deletions src/legacy/deprecation/deprecations/__tests__/unused.js

This file was deleted.

21 changes: 0 additions & 21 deletions src/legacy/deprecation/deprecations/index.js

This file was deleted.

Loading

0 comments on commit 19b212d

Please sign in to comment.