Skip to content

Commit 6494117

Browse files
committed
fixup
1 parent 217fdd5 commit 6494117

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

plugins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCAProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,11 @@ private boolean saveNewRootCAKeypair() {
322322
if (!configDao.update(rootCAPrivateKey.key(), rootCAPrivateKey.category(), CertUtils.privateKeyToPem(keyPair.getPrivate()))) {
323323
logger.error("Failed to save RootCA private key");
324324
}
325+
caKeyPair = keyPair;
325326
} catch (final NoSuchProviderException | NoSuchAlgorithmException | IOException e) {
326327
logger.error("Failed to generate/save RootCA private/public keys due to exception:", e);
327328
}
328-
return loadRootCAKeyPair();
329+
return caKeyPair != null && caKeyPair.getPrivate() != null && caKeyPair.getPublic() != null;
329330
}
330331

331332
boolean saveNewRootCACertificate() {
@@ -351,6 +352,9 @@ boolean saveNewRootCACertificate() {
351352
}
352353

353354
private boolean loadRootCAKeyPair() {
355+
if (caKeyPair != null) {
356+
return true;
357+
}
354358
if (StringUtils.isAnyEmpty(rootCAPublicKey.value(), rootCAPrivateKey.value())) {
355359
return false;
356360
}
@@ -364,6 +368,9 @@ private boolean loadRootCAKeyPair() {
364368
}
365369

366370
boolean loadRootCACertificate() {
371+
if (caCertificate != null && CollectionUtils.isNotEmpty(caCertificates)) {
372+
return true;
373+
}
367374
caCertificate = null;
368375
caCertificates = null;
369376
if (StringUtils.isEmpty(rootCACertificate.value())) {

0 commit comments

Comments
 (0)