Skip to content

Commit 1bafc58

Browse files
committed
Handle defaultdict schema correctly
1 parent 8bf7d2a commit 1bafc58

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

st2common/st2common/util/config_loader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ def _assign_dynamic_config_values(self, schema, config, parent_keys=None):
135135
for config_item_key, config_item_value in iterator:
136136
if config_is_dict:
137137
# different schema for each key/value pair
138-
schema_item = schema.get(config_item_key, {})
138+
try:
139+
# do not use schema.get() as schema might be a defaultdict
140+
schema_item = schema[config_item_key]
141+
except KeyError:
142+
schema_item = {}
139143
if config_is_list:
140144
# same schema is shared between every item in the list
141145
schema_item = schema

0 commit comments

Comments
 (0)