private void mergeConfigurations(Map<String, Map<String, String>> configurations, String type,
                                   Map<String, String> updates,
                                   Map<String, Map<String, String>> replacements) throws AmbariException {
    if (updates != null) {
      Map<String, String> existingProperties = configurations.get(type);
      if (existingProperties == null) {
        existingProperties = new HashMap<>();
        configurations.put(type, existingProperties);
      }

      for (Map.Entry<String, String> property : updates.entrySet()) {
        existingProperties.put(
          variableReplacementHelper.replaceVariables(property.getKey(), replacements),
          variableReplacementHelper.replaceVariables(property.getValue(), replacements)
        );
      }
    }
  }
Merges configuration from a Map of configuration updates into a main configurations Map.  Each
property in the updates Map is processed to replace variables using the replacement Map.
<p/>
See {@link VariableReplacementHelper#replaceVariables(String, java.util.Map)}
for information on variable replacement.

@param configurations a Map of configurations
@param type           the configuration type
@param updates        a Map of property updates
@param replacements   a Map of (grouped) replacement values
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java