@Override
  protected void exportKeytabFile(String principal, String keytabFileDestinationPath, Set<EncryptionType> keyEncryptionTypes) throws KerberosOperationException {
    String encryptionTypeSpec = null;
    if (!CollectionUtils.isEmpty(keyEncryptionTypes)) {
      StringBuilder encryptionTypeSpecBuilder = new StringBuilder();
      for (EncryptionType encryptionType : keyEncryptionTypes) {
        if (encryptionTypeSpecBuilder.length() > 0) {
          encryptionTypeSpecBuilder.append(',');
        }
        encryptionTypeSpecBuilder.append(encryptionType.getName());
      }

      encryptionTypeSpec = encryptionTypeSpecBuilder.toString();
    }

    String[] createKeytabFileCommand = (StringUtils.isEmpty(encryptionTypeSpec))
        ? new String[]{executableIpaGetKeytab, "-s", getAdminServerHost(true), "-p", principal, "-k", keytabFileDestinationPath}
        : new String[]{executableIpaGetKeytab, "-s", getAdminServerHost(true), "-e", encryptionTypeSpec, "-p", principal, "-k", keytabFileDestinationPath};

    ShellCommandUtil.Result result = executeCommand(createKeytabFileCommand);
    if (!result.isSuccessful()) {
      String message = String.format("Failed to export the keytab file for %s:\n\tExitCode: %s\n\tSTDOUT: %s\n\tSTDERR: %s",
          principal, result.getExitCode(), result.getStdout(), result.getStderr());
      LOG.warn(message);
      throw new KerberosOperationException(message);
    }
  }
Removes an existing principal in a previously configured KDC
<p/>
The implementation is specific to a particular type of KDC.

@param principal a String containing the principal to remove
@param service   a boolean value indicating whether the principal is for a service or not
@return true if the principal was successfully removed; otherwise false
@throws KerberosKDCConnectionException       if a connection to the KDC cannot be made
@throws KerberosAdminAuthenticationException if the administrator credentials fail to authenticate
@throws KerberosRealmException               if the realm does not map to a KDC
@throws KerberosOperationException           if an unexpected error occurred
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java