From c82913973269c424736a730a42c42bb94d3a3f58 Mon Sep 17 00:00:00 2001 From: kobelb Date: Mon, 6 Feb 2017 09:33:24 -0500 Subject: [PATCH] Resolving unused settings bug when plugin is disabled --- src/server/config/__tests__/config.js | 19 ------------------- src/server/config/config.js | 10 ---------- src/server/plugins/plugin_collection.js | 6 ------ 3 files changed, 35 deletions(-) diff --git a/src/server/config/__tests__/config.js b/src/server/config/__tests__/config.js index 200140adca6c8..641bf55d683d0 100644 --- a/src/server/config/__tests__/config.js +++ b/src/server/config/__tests__/config.js @@ -238,24 +238,5 @@ describe('lib/config/config', function () { }); }); - - describe('#removeSchema(key)', function () { - it('should completely remove the key', function () { - const config = new Config(Joi.object().keys({ - a: Joi.number().default(1) - })); - - expect(config.get('a')).to.be(1); - config.removeSchema('a'); - expect(() => config.get('a')).to.throwException('Unknown config key'); - }); - - it('only removes existing keys', function () { - const config = new Config(Joi.object()); - - expect(() => config.removeSchema('b')).to.throwException('Unknown schema'); - }); - }); - }); }); diff --git a/src/server/config/config.js b/src/server/config/config.js index 1d036ca63e96a..dc7808a8736e2 100644 --- a/src/server/config/config.js +++ b/src/server/config/config.js @@ -42,16 +42,6 @@ module.exports = class Config { this.set(key, settings); } - removeSchema(key) { - if (!_.has(this[schemaExts], key)) { - throw new TypeError(`Unknown schema key: ${key}`); - } - - this[schema] = null; - unset(this[schemaExts], key); - unset(this[vals], key); - } - resetTo(obj) { this._commit(obj); } diff --git a/src/server/plugins/plugin_collection.js b/src/server/plugins/plugin_collection.js index 2d479dedcbd79..33d0fa669924e 100644 --- a/src/server/plugins/plugin_collection.js +++ b/src/server/plugins/plugin_collection.js @@ -24,11 +24,6 @@ async function addPluginConfig(pluginCollection, plugin) { config.extendSchema(configSchema, transformedPluginSettings, plugin.configPrefix); } -function removePluginConfig(pluginCollection, plugin) { - const { config } = pluginCollection.kbnServer; - config.removeSchema(plugin.configPrefix); -} - module.exports = class Plugins extends Collection { constructor(kbnServer) { @@ -60,7 +55,6 @@ module.exports = class Plugins extends Collection { } async disable(plugin) { - removePluginConfig(this, plugin); this.delete(plugin); }