private boolean canRetryCommand(HostRoleCommandEntity hrc) {
    if (hrc.isRetryAllowed() && !hrc.isFailureAutoSkipped()) {
      // Important not to retry some steps during RU/EU like "Finalize Upgrade Pre-Check", "Execute HDFS Finalize", and "Save Cluster State".
      // These elements are expected to be in lowercase already
      if (null != hrc.getCustomCommandName()) {
        for (String s : CUSTOM_COMMAND_NAMES_TO_IGNORE) {
          if (hrc.getCustomCommandName().toLowerCase().contains(s)){
            return false;
          }
        }
      }
      if (null != hrc.getCommandDetail()) {
        for (String s : COMMAND_DETAILS_TO_IGNORE) {
          if (hrc.getCommandDetail().toLowerCase().contains(s)) {
            return false;
          }
        }
      }
      return true;
    }
    return false;
  }
Private method to determine if a Host Role Command can be retried.
@param hrc Host Role Command entity.
@return True if can be retried, otherwise false.
ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java