Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
config: Solve interpolation recursion error
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung committed Mar 1, 2021
1 parent 4c4fec5 commit 0716bac
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions kraft/config/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,25 +170,37 @@ def process_item(name, config_dict):
if isinstance(config_dict, six.string_types):
return interpolator.interpolate(config_dict)

return dict(
(key, interpolate_value(name, key, val, section, interpolator))
for key, val in (config_dict or {}).items()
)
elif isinstance(config_dict, list):
return list(
interpolator.interpolate(val)
for val in config_dict
)

elif isinstance(config_dict, dict):
return dict(
(key, interpolate_value(name, key, val, section, interpolator))
for key, val in (config_dict or {}).items()
)

return config_dict

if isinstance(config, six.string_types):
return interpolator.interpolate(config)

elif isinstance(config, list):
return list(
process_item(None, item) for item in config
process_item(None, config_dict or {})
for config_dict in config
)

else:
elif isinstance(config, dict):
return dict(
(name, process_item(name, config_dict or {}))
for name, config_dict in config.items()
)

return config


class ConversionMap(object):
map = {}
Expand Down

0 comments on commit 0716bac

Please sign in to comment.