values to be substituted.
:returns: The modified input_dict
"""
- input_dict = dict(input_dict)
- for (key, value) in input_dict.iteritems():
- if isinstance(value, dict):
- substitute_placeholders(value, values_dict)
- elif isinstance(value, Placeholder):
- # If there is a Placeholder without a corresponding entry in
- # values_dict, we will hit a KeyError - we want this.
- input_dict[key] = values_dict[value.name]
- return input_dict
+ input_dict = copy.deepcopy(input_dict)
+
+ def _substitute(input_dict, values_dict):
+ for (key, value) in input_dict.iteritems():
+ if isinstance(value, dict):
+ _substitute(value, values_dict)
+ elif isinstance(value, Placeholder):
+ # If there is a Placeholder without a corresponding entry in
+ # values_dict, we will hit a KeyError - we want this.
+ input_dict[key] = values_dict[value.name]
+ return input_dict
+
+ return _substitute(input_dict, values_dict)
# Template for the config that becomes the base for each generated job config