This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 79ac0c2d89 NIFI-13570 Use NiFiProperties isHTTPSConfigured to 
determine if NAR Manager should use https This closes #9100
79ac0c2d89 is described below

commit 79ac0c2d89107dc68aed224aad88a2236d8a7a76
Author: Bryan Bende <[email protected]>
AuthorDate: Mon Jul 22 11:21:07 2024 -0400

    NIFI-13570 Use NiFiProperties isHTTPSConfigured to determine if NAR Manager 
should use https
    This closes #9100
    
    Signed-off-by: Joseph Witt <[email protected]>
---
 .../configuration/FlowControllerConfiguration.java         |  2 +-
 .../main/java/org/apache/nifi/nar/StandardNarManager.java  | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/framework/configuration/FlowControllerConfiguration.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/framework/configuration/FlowControllerConfiguration.java
index 4ffb54f2a0..2b54066191 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/framework/configuration/FlowControllerConfiguration.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/framework/configuration/FlowControllerConfiguration.java
@@ -431,7 +431,7 @@ public class FlowControllerConfiguration {
                 narComponentManager(),
                 narLoader(),
                 webClientService(),
-                sslContext
+                properties
         );
     }
 }
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/StandardNarManager.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/StandardNarManager.java
index 440e35de2c..95ff21895e 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/StandardNarManager.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/nar/StandardNarManager.java
@@ -17,12 +17,14 @@
 
 package org.apache.nifi.nar;
 
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.nifi.bundle.Bundle;
 import org.apache.nifi.bundle.BundleCoordinate;
 import org.apache.nifi.cluster.coordination.ClusterCoordinator;
 import org.apache.nifi.cluster.protocol.NodeIdentifier;
 import org.apache.nifi.controller.FlowController;
 import org.apache.nifi.controller.service.ControllerServiceProvider;
+import org.apache.nifi.util.NiFiProperties;
 import org.apache.nifi.web.ResourceNotFoundException;
 import org.apache.nifi.web.api.dto.NarSummaryDTO;
 import org.apache.nifi.web.api.entity.NarSummariesEntity;
@@ -32,7 +34,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.InitializingBean;
 
-import javax.net.ssl.SSLContext;
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -71,7 +72,7 @@ public class StandardNarManager implements NarManager, 
InitializingBean, Closeab
     private final NarComponentManager narComponentManager;
     private final NarLoader narLoader;
     private final WebClientService webClientService;
-    private final SSLContext sslContext;
+    private final NiFiProperties properties;
 
     private final Map<String, NarNode> narNodesById = new 
ConcurrentHashMap<>();
     private final Map<String, Future<?>> installFuturesById = new 
ConcurrentHashMap<>();
@@ -84,7 +85,7 @@ public class StandardNarManager implements NarManager, 
InitializingBean, Closeab
                               final NarComponentManager narComponentManager,
                               final NarLoader narLoader,
                               final WebClientService webClientService,
-                              final SSLContext sslContext) {
+                              final NiFiProperties properties) {
         this.clusterCoordinator = clusterCoordinator;
         this.extensionManager = flowController.getExtensionManager();
         this.controllerServiceProvider = 
flowController.getControllerServiceProvider();
@@ -92,7 +93,7 @@ public class StandardNarManager implements NarManager, 
InitializingBean, Closeab
         this.narComponentManager = narComponentManager;
         this.narLoader = narLoader;
         this.webClientService = webClientService;
-        this.sslContext = sslContext;
+        this.properties = properties;
         this.installExecutorService = Executors.newSingleThreadExecutor();
         this.deleteExecutorService = Executors.newSingleThreadExecutor();
     }
@@ -245,7 +246,7 @@ public class StandardNarManager implements NarManager, 
InitializingBean, Closeab
         logger.info("Synchronizing NARs with cluster coordinator");
         final String coordinatorAddress = coordinatorNodeId.getApiAddress();
         final int coordinatorPort = coordinatorNodeId.getApiPort();
-        final NarRestApiClient narRestApiClient = new 
NarRestApiClient(webClientService, coordinatorAddress, coordinatorPort, 
sslContext != null);
+        final NarRestApiClient narRestApiClient = new 
NarRestApiClient(webClientService, coordinatorAddress, coordinatorPort, 
properties.isHTTPSConfigured());
 
         final int localNarCountBeforeSync = narNodesById.size();
         try {
@@ -315,7 +316,8 @@ public class StandardNarManager implements NarManager, 
InitializingBean, Closeab
         try {
             return narRestApiClient.listNarSummaries();
         } catch (final NarRestApiRetryableException e) {
-            logger.warn("{}: retrying", e.getMessage());
+            final Throwable rootCause = ExceptionUtils.getRootCause(e);
+            logger.warn("{}, root cause [{}]: retrying", e.getMessage(), 
rootCause.getMessage());
             return null;
         }
     }

Reply via email to