Skip to content

Commit

Permalink
Handle defaultdict schema correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Apr 9, 2021
1 parent 8bf7d2a commit a2644c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion st2common/st2common/util/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ def _assign_dynamic_config_values(self, schema, config, parent_keys=None):
for config_item_key, config_item_value in iterator:
if config_is_dict:
# different schema for each key/value pair
schema_item = schema.get(config_item_key, {})
try:
# do not use schema.get() as schema might be a defaultdict
schema_item = schema[config_item_key]
except KeyError:
schema_item = {}
if config_is_list:
# same schema is shared between every item in the list
schema_item = schema
Expand Down

0 comments on commit a2644c2

Please sign in to comment.