protected String getFailReason(String key, UpgradeCheckResult upgradeCheckResult,
      UpgradeCheckRequest request) throws AmbariException {
    String fail = m_description.getFailureReason(key);

    RepositoryVersion repositoryVersion = request.getTargetRepositoryVersion();
    if (fail.contains("{{version}}") && null != repositoryVersion) {
      fail = fail.replace("{{version}}", repositoryVersion.getVersion());
    }

    if (fail.contains("{{fails}}")) {
      LinkedHashSet<String> names = upgradeCheckResult.getFailedOn();

      // If Type=PrereqCheckType.HOST, names list is already populated
      if (getDescription().getType() == UpgradeCheckType.SERVICE) {
        Clusters clusters = clustersProvider.get();
        AmbariMetaInfo metaInfo = ambariMetaInfo.get();

        Cluster c = clusters.getCluster(request.getClusterName());
        Map<String, ServiceInfo> services = metaInfo.getServices(
            c.getDesiredStackVersion().getStackName(),
            c.getDesiredStackVersion().getStackVersion());

        LinkedHashSet<String> displays = new LinkedHashSet<>();
        for (String name : names) {
          if (services.containsKey(name)) {
            displays.add(services.get(name).getDisplayName());
          } else {
            displays.add(name);
          }
        }
        names = displays;

      }

      fail = fail.replace("{{fails}}", formatEntityList(names));
    }

    return fail;
  }
Gets the fail reason
@param key               the failure text key
@param UpgradeCheck the check being performed
@param request           the request
@return the failure string
ambari-server/src/main/java/org/apache/ambari/server/checks/ClusterCheck.java