HomePhabricator

Correct behavior when setting new configuration keys

Authored by chris on Aug 11 2019, 2:58 PM.

Description

Correct behavior when setting new configuration keys

Summary: This corrects an issue where setting a new key (or updating an existing one) in a local config source would totally nuke all other config options you had set previously. This was introduced at simplex/scripts/config/manage_config.py$50 by D20 --- translating period-separated CLI config keys (mysql.user) to a nested dictionary (obj['mysql]['user']) created a bad interaction with SimplexConfigDefaultSource.set_keys() since it turns out that merging two nested dictionaries is a little tricky and requires some recursion that Python doesn't want to do out of the box.

Test Plan:

$ ./bin/config --list
INFO:root:[INFO]:
  mysql:  {'host': '127.0.0.1'}

$ ./bin/config --set mysql.test flarp
INFO:root:[INFO]: Set local configuration values for mysql.test

$ ./bin/config --list
INFO:root:[INFO]:
  mysql:  {'host': '127.0.0.1', 'test': 'flarp'}

Reviewers: brooke

Reviewed By: brooke

Differential Revision: https://phabricator.tbmh.org/D21

Details

Committed
chrisAug 17 2019, 7:50 AM
Pushed
chrisAug 17 2019, 7:50 AM
Reviewer
brooke
Differential Revision
D21: Correct behavior when setting new configuration keys
Parents
rSIMcd9677225ad6: Clean up some internal imports
Branches
Unknown
Tags
Unknown