From 657bd369d04f44c74fedfde52264ad49886dbb7d Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 14 Jul 2014 15:16:55 -0600 Subject: [PATCH] Fix the incomplete substitute_placeholders() fix Signed-off-by: Zack Cerza --- teuthology/suite.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/teuthology/suite.py b/teuthology/suite.py index c2acf9d00e42a..95483bd6d1030 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -631,15 +631,19 @@ def substitute_placeholders(input_dict, values_dict): 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 -- 2.39.5