class ComponentVersionCheckAction extends FinalizeUpgradeAction {

  @Override
  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
      throws AmbariException, InterruptedException {

    String clusterName = getExecutionCommand().getClusterName();

    Cluster cluster = getClusters().getCluster(clusterName);

    UpgradeContext upgradeContext = getUpgradeContext(cluster);
    Set<InfoTuple> errors = validateComponentVersions(upgradeContext);

    StringBuilder outSB = new StringBuilder();
    StringBuilder errSB = new StringBuilder();

    if (errors.isEmpty()) {
      outSB.append("All service components are reporting the correct version.");
      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", outSB.toString(), errSB.toString());
    } else {
      String structuredOut = getErrors(outSB, errSB, errors);
      return createCommandReport(-1, HostRoleStatus.FAILED, structuredOut, outSB.toString(), errSB.toString());
    }
  }

}