private void mergeStackWithParent(
      String parentVersion, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions)
      throws AmbariException {

    String parentStackKey = stackInfo.getName() + StackManager.PATH_DELIMITER + parentVersion;
    StackModule parentStack = allStacks.get(parentStackKey);

    if (parentStack == null) {
      throw new AmbariException("Stack '" + stackInfo.getName() + ":" + stackInfo.getVersion() +
          "' specifies a parent that doesn't exist");
    }

    resolveStack(parentStack, allStacks, commonServices, extensions);
    mergeConfigurations(parentStack, allStacks, commonServices, extensions);
    mergeRoleCommandOrder(parentStack);

    // grab stack level kerberos_preconfigure.json from parent stack
    if (stackInfo.getKerberosDescriptorPreConfigurationFileLocation() == null) {
      stackInfo.setKerberosDescriptorPreConfigurationFileLocation(parentStack.getModuleInfo().getKerberosDescriptorPreConfigurationFileLocation());
    }

    mergeServicesWithParent(parentStack, allStacks, commonServices, extensions);
  }
Merge the stack with its parent.

@param allStacks      all stacks in stack definition
@param commonServices all common services specified in the stack definition
@param parentVersion  version of the stacks parent

@throws AmbariException if an exception occurs merging with the parent
ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java