private synchronized void ensureVersionDefinitions() {
    if (null != versionDefinitions) {
      if(versionDefinitions.size() > 0)
        return;
    }

    versionDefinitions = new HashMap<>();

    for (StackInfo stack : getStacks()) {
      if (stack.isActive() && stack.isValid()) {
        for (VersionDefinitionXml definition : stack.getVersionDefinitions()) {
          versionDefinitions.put(String.format("%s-%s-%s", stack.getName(),
            stack.getVersion(), definition.release.version), definition);
        }
        
        try {
          // !!! check for a "latest-vdf" one.  This will be used for the default if one is not found.
          VersionDefinitionXml xml = stack.getLatestVersionDefinition();

          if (null == xml) {
            // !!! "latest-vdf" was not found, use the stack.  this is the last-ditch effort
            xml = VersionDefinitionXml.build(stack);
          }

          versionDefinitions.put(String.format("%s-%s", stack.getName(), stack.getVersion()), xml);
        } catch (Exception e) {
          LOG.warn("Could not make a stack VDF for {}-{}: {}",
              stack.getName(), stack.getVersion(), e.getMessage());
        }
      } else {
        StackId stackId = new StackId(stack);
        if (!stack.isValid()) {
          LOG.info("Stack {} is not valid, skipping VDF: {}", stackId, StringUtils.join(stack.getErrors(), "; "));
        } else if (!stack.isActive()) {
          LOG.info("Stack {} is not active, skipping VDF", stackId);
        }
      }

    }
  }
Ensures that the map of version definition files is populated
ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java