mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 17:15:17 +00:00
Fix #908: updating configuration without secrets was failing
This commit is contained in:
parent
6104e5df3c
commit
33a5e06eb1
@ -38,7 +38,7 @@ class ConfigurationContainer(object):
|
||||
return self._config.iteritems()
|
||||
|
||||
def to_dict(self, mask_secrets=False):
|
||||
if (mask_secrets is False or 'secret' not in self.schema):
|
||||
if mask_secrets is False or 'secret' not in self.schema:
|
||||
return self._config
|
||||
|
||||
config = self._config.copy()
|
||||
@ -53,7 +53,7 @@ class ConfigurationContainer(object):
|
||||
|
||||
config = {}
|
||||
for k, v in new_config.iteritems():
|
||||
if k in self.schema['secret'] and v == SECRET_PLACEHOLDER:
|
||||
if k in self.schema.get('secret', []) and v == SECRET_PLACEHOLDER:
|
||||
config[k] = self[k]
|
||||
else:
|
||||
config[k] = v
|
||||
|
@ -74,3 +74,10 @@ class TestConfigurationUpdate(TestCase):
|
||||
self.assertEqual(container['a'], 1)
|
||||
self.assertEqual('test', container['b'])
|
||||
self.assertNotIn('e', container)
|
||||
|
||||
def test_works_for_schema_without_secret(self):
|
||||
secretless = configuration_schema.copy()
|
||||
secretless.pop('secret')
|
||||
container = ConfigurationContainer({'a': 1, 'b': 'test', 'e': 3}, secretless)
|
||||
container.update({'a': 2})
|
||||
self.assertEqual(container['a'], 2)
|
||||
|
Loading…
Reference in New Issue
Block a user