public boolean createKeytabFile(Keytab keytab, File destinationKeytabFile)
      throws KerberosOperationException {

    if (destinationKeytabFile == null) {
      throw new KerberosOperationException("The destination file path is null");
    }

    try {
      mergeKeytabs(readKeytabFile(destinationKeytabFile), keytab).write(destinationKeytabFile);
      return true;
    } catch (IOException e) {
      String message = "Failed to export keytab file";
      LOG.error(message, e);

      if (!destinationKeytabFile.delete()) {
        destinationKeytabFile.deleteOnExit();
      }

      throw new KerberosOperationException(message, e);
    }
  }
Create or append to a keytab file using the specified Keytab
<p/>
If the destination keytab file contains keytab data, that data will be merged with the new data
to create a composite set of keytab entries.

@param keytab                the Keytab containing the data to add to the keytab file
@param destinationKeytabFile a File containing the absolute path to where the keytab data is to be stored
@return true if the keytab file was successfully created; false otherwise
@throws KerberosOperationException
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java