Skip to content
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

Remove LP deprecations #76536

Merged
merged 7 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines -44 to -50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So glad this finally goes away.

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