You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/03/25 17:50:16 UTC

[GitHub] [cloudstack] nvazquez commented on a change in pull request #6104: Direct download certificates additions and improvements

nvazquez commented on a change in pull request #6104:
URL: https://github.com/apache/cloudstack/pull/6104#discussion_r835493076



##########
File path: server/src/main/java/org/apache/cloudstack/direct/download/DirectDownloadManagerImpl.java
##########
@@ -475,48 +486,55 @@ public boolean uploadCertificateToHosts(String certificateCer, String alias, Str
             certificateVO = directDownloadCertificateDao.findByAlias(alias, hypervisorType, zoneId);
             if (certificateVO == null) {
                 s_logger.info("Certificate must be uploaded on zone " + zoneId);
-                return false;
+                return new ArrayList<>();
             }
         }
 
         s_logger.info("Attempting to upload certificate: " + alias + " to " + hosts.size() + " hosts on zone " + zoneId);
-        int hostCount = 0;
+        int success = 0;
+        int failed = 0;
+        List<HostCertificateStatus> results = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(hosts)) {
             for (HostVO host : hosts) {
-                if (!uploadCertificate(certificateVO.getId(), host.getId())) {
-                    String msg = "Could not upload certificate " + alias + " on host: " + host.getName() + " (" + host.getUuid() + ")";
+                if (host == null) {
+                    continue;
+                }
+                HostCertificateStatus hostStatus;
+                Pair<Boolean, String> result = provisionCertificate(certificateVO.getId(), host.getId());
+                if (!result.first()) {
+                    String msg = "Could not upload certificate " + alias + " on host: " + host.getName() + " (" + host.getUuid() + "): " + result.second();
                     s_logger.error(msg);
-                    throw new CloudRuntimeException(msg);
+                    failed++;

Review comment:
       Yes, there is a new API for provisioning certificate to a host




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org