diff --git a/core/src/main/python/wlsdeploy/util/cla_helper.py b/core/src/main/python/wlsdeploy/util/cla_helper.py index 44f6fcf94..b4e3c3120 100644 --- a/core/src/main/python/wlsdeploy/util/cla_helper.py +++ b/core/src/main/python/wlsdeploy/util/cla_helper.py @@ -383,10 +383,8 @@ def _get_merge_match_key(key, variable_map): :param variable_map: variable map to use for substitutions :return: the key to use for matching """ - if variable_map is not None: - match_key = variables.substitute_key(key, variable_map) - else: - match_key = key + + match_key = variables.substitute_key(key, variable_map) if model_helper.is_delete_name(match_key): match_key = model_helper.get_delete_item_name(match_key) diff --git a/core/src/main/python/wlsdeploy/util/variables.py b/core/src/main/python/wlsdeploy/util/variables.py index 9c81de0f1..6d759bfbd 100644 --- a/core/src/main/python/wlsdeploy/util/variables.py +++ b/core/src/main/python/wlsdeploy/util/variables.py @@ -446,11 +446,24 @@ def substitute_key(text, variables): :param variables: the variable map :return: the substituted text value """ - matches = _property_pattern.findall(text) + method_name = "substitute_key" + + if variables is not None: + matches = _property_pattern.findall(text) + for token, key in matches: + if key in variables: + value = variables[key] + text = text.replace(token, value) + + matches = _environment_pattern.findall(text) for token, key in matches: - if key in variables: - value = variables[key] - text = text.replace(token, value) + # log, or throw an exception if key is not found. + if not os.environ.has_key(key): + continue + + value = os.environ.get(key) + text = text.replace(token, value) + return text diff --git a/core/src/test/python/wlsdeploy/util/cla_helper_test.py b/core/src/test/python/wlsdeploy/util/cla_helper_test.py index cb07a8403..d50054e04 100644 --- a/core/src/test/python/wlsdeploy/util/cla_helper_test.py +++ b/core/src/test/python/wlsdeploy/util/cla_helper_test.py @@ -60,6 +60,7 @@ def testMergeModels(self): } variables = {} + cla_helper.merge_model_dictionaries(dictionary, new_dictionary, variables) # print("Merged model: " + str(dictionary))