nvazquez commented on a change in pull request #2995: Improvements on upload
direct download certificates
URL: https://github.com/apache/cloudstack/pull/2995#discussion_r231108575
##########
File path: agent/src/com/cloud/agent/Agent.java
##########
@@ -697,16 +697,34 @@ private Answer
setupDirectDownloadCertificate(SetupDirectDownloadCertificate cmd
final String keyStoreFile = agentFile.getParent() + "/" +
KeyStoreUtils.KS_FILENAME;
- String cerFile = agentFile.getParent() + "/" + certificateName +
".cer";
- Script.runSimpleBashScript(String.format("echo '%s' > %s",
certificate, cerFile));
+ String cerFile = agentFile.getParent() + "/" + "CSCERTIFICATE-" +
certificateName;
+ s_logger.debug("Creating temporary certificate file into: " + cerFile);
+ int result =
Script.runSimpleBashScriptForExitValue(String.format("echo '%s' > %s",
certificate, cerFile));
+ if (result != 0) {
+ return new Answer(cmd, false, "Could not create the certificate
file on path: " + cerFile);
+ }
+
+ s_logger.debug("Retrieving keystore password");
String privatePasswordFormat = "sed -n '/keystore.passphrase/p' '%s'
2>/dev/null | sed 's/keystore.passphrase=//g' 2>/dev/null";
String privatePasswordCmd = String.format(privatePasswordFormat,
agentFile.getAbsolutePath());
String privatePassword =
Script.runSimpleBashScript(privatePasswordCmd);
+ if (org.apache.commons.lang.StringUtils.isBlank(privatePassword)) {
Review comment:
Actually the check is because we're using the existing cloud.jks keystore
and it is password protected
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services