private Map<String, Map<String, Map<ProvisionAction, Set<String>>>> findComponentsWithCustomAction() {
    Preconditions.checkState(customServiceActions != null);

    Map<String, String> serviceByComponent = mapServicesByComponent();

    Map<String, Map<String, Map<ProvisionAction, Set<String>>>> result = new HashMap<>();
    for (Component component : request.getRequest().getComponents()) {
      component.getProvisionAction().ifPresent(componentAction -> {
        String componentName = component.getName();
        String serviceName = serviceByComponent.get(componentName);
        ProvisionAction serviceAction = customServiceActions.getOrDefault(serviceName, request.getRequest().getProvisionAction());
        if (!Objects.equals(serviceAction, componentAction)) {
          result
            .computeIfAbsent(serviceName, __ -> new HashMap<>())
            .computeIfAbsent(componentName, __ -> new EnumMap<>(ProvisionAction.class))
            .computeIfAbsent(componentAction, __ -> new HashSet<>())
            .addAll(component.getHosts().stream().map(Host::getFqdn).collect(toSet()));
        }
      });
    }
    return result;
  }
Finds all host components for which custom provision action was specified in the request.

@return service -> component -> action -> hosts mapping; only contains components whose action does not match the upper-level (service or request) action
ambari-server/src/main/java/org/apache/ambari/server/topology/addservice/ProvisionActionPredicateBuilder.java