private List<RecoveryConfigComponent> getEnabledComponents(String hostname) throws AmbariException {
      List<RecoveryConfigComponent> enabledComponents = new ArrayList<>();

      if (cluster == null) {
        return enabledComponents;
      }

      Host host = clusters.getHost(hostname);
      if (host == null) {
        return enabledComponents;
      }

      // if host is in maintenance mode then ignore all the components for auto start
      if (host.getMaintenanceState(cluster.getClusterId()) == MaintenanceState.ON) {
        return enabledComponents;
      }

      List<ServiceComponentHost> scHosts = cluster.getServiceComponentHosts(hostname);

      for (ServiceComponentHost sch : scHosts) {
        if (sch.isRecoveryEnabled()) {
          Service service = cluster.getService(sch.getServiceName());

          // service should not be in maintenance mode
          if (service.getMaintenanceState() == MaintenanceState.OFF) {
            // Keep the components that are not in maintenance mode.
            if (sch.getMaintenanceState() == MaintenanceState.OFF) {
              enabledComponents.add(new RecoveryConfigComponent(sch));
            }
          }
        }
      }

      return enabledComponents;
    }
Get a list of enabled components for the specified host and cluster. Filter by
Maintenance Mode OFF, so that agent does not auto start components that are in
maintenance mode.
@return
ambari-server/src/main/java/org/apache/ambari/server/agent/RecoveryConfigHelper.java