@Override
  public RequestStageContainer executeCustomOperations(Cluster cluster, Map<String, String> requestProperties,
                                                       RequestStageContainer requestStageContainer,
                                                       Boolean manageIdentities)
    throws AmbariException, KerberosOperationException {

    if (requestProperties != null) {

      for (SupportedCustomOperation operation : SupportedCustomOperation.values()) {
        if (requestProperties.containsKey(operation.name().toLowerCase())) {
          String value = requestProperties.get(operation.name().toLowerCase());

          // The operation specific logic is kept in one place and described here
          switch (operation) {
            case REGENERATE_KEYTABS:
              if (cluster.getSecurityType() != SecurityType.KERBEROS) {
                throw new AmbariException(String.format("Custom operation %s can only be requested with the security type cluster property: %s", operation.name(), SecurityType.KERBEROS.name()));
              }

              KerberosServerAction.OperationType operationType;
              if ("true".equalsIgnoreCase(value) || "all".equalsIgnoreCase(value)) {
                operationType = KerberosServerAction.OperationType.RECREATE_ALL;
              } else if ("missing".equalsIgnoreCase(value)) {
                operationType = KerberosServerAction.OperationType.CREATE_MISSING;
              } else {
                throw new AmbariException(String.format("Unexpected directive value: %s", value));
              }

              boolean retryAllowed = false;
              if (requestProperties.containsKey(ALLOW_RETRY)) {
                String allowRetryString = requestProperties.get(ALLOW_RETRY);
                retryAllowed = Boolean.parseBoolean(allowRetryString);
              }

              Set<String> hostFilter = parseHostFilter(requestProperties);
              Map<String, Set<String>> serviceComponentFilter = parseComponentFilter(requestProperties);

              UpdateConfigurationPolicy updateConfigurationsPolicy = UpdateConfigurationPolicy.ALL;
              if(requestProperties.containsKey(DIRECTIVE_CONFIG_UPDATE_POLICY)) {
                String policyValue = requestProperties.get(DIRECTIVE_CONFIG_UPDATE_POLICY);
                updateConfigurationsPolicy = UpdateConfigurationPolicy.translate(policyValue);

                if(updateConfigurationsPolicy== null) {
                  throw new AmbariException(String.format("Unexpected comfiguration policy value: %s", policyValue));
                }
              }
              else if(requestProperties.containsKey(DIRECTIVE_IGNORE_CONFIGS)) {
                if("true".equalsIgnoreCase(requestProperties.get(DIRECTIVE_IGNORE_CONFIGS))) {
                  // This really means to no update existing properties. However, we need to ensure
                  // that Kerberos identity specific configurations are updated or added to make
                  // sure all is consistent.
                  updateConfigurationsPolicy = UpdateConfigurationPolicy.NEW_AND_IDENTITIES;
                }
              }

              boolean forceAllHosts = (hostFilter == null) || (hostFilter.contains("*"));

              CreatePrincipalsAndKeytabsHandler handler = new CreatePrincipalsAndKeytabsHandler(operationType, updateConfigurationsPolicy, forceAllHosts, true);
              handler.setRetryAllowed(retryAllowed);

              requestStageContainer = handle(cluster, getKerberosDetails(cluster, manageIdentities),
                  serviceComponentFilter, hostFilter, null, null, requestStageContainer, handler);

              break;

            default: // No other operations are currently supported
              throw new AmbariException(String.format("Custom operation not supported: %s", operation.name()));
          }
        }
      }
    }

    return requestStageContainer;
  }
The secure storage facility to use to store KDC administrator credential.
ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java