Skip to content

Commit

Permalink
APPSERV-151 Create TLS directory if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandrex247 committed Jun 4, 2020
1 parent f10a929 commit 88ca567
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ protected int executeCommand() throws CommandException {
throw new CommandException("Error parsing domain.xml", miniXmlParserException);
}

File csrLocation = new File(getInstallRootPath() + File.separator + "tls");

// Run keytool command to generate CSR and place in csrLocation
try {
generateCsr(csrLocation);
generateCsr();
} catch (CommandException ce) {
return CLIConstants.ERROR;
}
Expand All @@ -121,7 +119,13 @@ protected int executeCommand() throws CommandException {
*
* @throws CommandException If there's an issue adding the certificate to the key store
*/
private void generateCsr(File csrLocation) throws CommandException {
private void generateCsr() throws CommandException {
// Get CSR install dir and ensure it actually exists
File csrLocation = new File(getInstallRootPath() + File.separator + "tls");
if (!csrLocation.exists()) {
csrLocation.mkdir();
}

// Run keytool command to generate self-signed cert
KeystoreManager.KeytoolExecutor keytoolExecutor = new KeystoreManager.KeytoolExecutor(
CertificateManagementKeytoolCommands.constructGenerateCertRequestKeytoolCommand(
Expand Down Expand Up @@ -218,11 +222,9 @@ protected int executeCommand() throws CommandException {
throw new CommandException("Error parsing domain.xml", miniXmlParserException);
}

File csrLocation = new File(getInstallRootPath() + File.separator + "tls");

// Run keytool command to generate CSR and place in csrLocation
try {
generateCsr(csrLocation);
generateCsr();
} catch (CommandException ce) {
return CLIConstants.ERROR;
}
Expand Down

0 comments on commit 88ca567

Please sign in to comment.