knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pzamp...@apache.org
Subject knox git commit: KNOX-1319 - Better logging when discovery fails to access service configurations
Date Thu, 17 May 2018 15:21:17 GMT
Repository: knox
Updated Branches:
  refs/heads/master 9a1a58401 -> 06df07ec9


KNOX-1319 - Better logging when discovery fails to access service configurations


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/06df07ec
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/06df07ec
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/06df07ec

Branch: refs/heads/master
Commit: 06df07ec93bd377fa50ef483dfadbf33eb1d8d39
Parents: 9a1a584
Author: Phil Zampino <pzampino@apache.org>
Authored: Thu May 17 11:07:48 2018 -0400
Committer: Phil Zampino <pzampino@apache.org>
Committed: Thu May 17 11:07:48 2018 -0400

----------------------------------------------------------------------
 .../topology/discovery/ambari/AmbariServiceDiscovery.java   | 9 ++++++---
 .../discovery/ambari/AmbariServiceDiscoveryMessages.java    | 7 ++++---
 .../topology/discovery/ambari/PropertyEqualsHandler.java    | 2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/06df07ec/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
index 4deb25f..821dc0e 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
@@ -293,9 +293,12 @@ class AmbariServiceDiscovery implements ServiceDiscovery {
             // Service configurations
             Map<String, Map<String, AmbariCluster.ServiceConfiguration>> serviceConfigurations
=
                 ambariClient.getActiveServiceConfigurations(discoveryAddress,
-                    clusterName,
-                    discoveryUser,
-                    discoveryPwdAlias);
+                                                            clusterName,
+                                                            discoveryUser,
+                                                            discoveryPwdAlias);
+            if (serviceConfigurations.isEmpty()) {
+                log.failedToAccessServiceConfigs(clusterName);
+            }
             for (Entry<String, Map<String, AmbariCluster.ServiceConfiguration>>
serviceConfiguration : serviceConfigurations.entrySet()) {
                 for (Map.Entry<String, AmbariCluster.ServiceConfiguration> serviceConfig
: serviceConfiguration.getValue().entrySet()) {
                     cluster.addServiceConfiguration(serviceConfiguration.getKey(), serviceConfig.getKey(),
serviceConfig.getValue());

http://git-wip-us.apache.org/repos/asf/knox/blob/06df07ec/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java
b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java
index 5cc764c..036d7a7 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryMessages.java
@@ -58,20 +58,21 @@ public interface AmbariServiceDiscoveryMessages {
                                                          @StackTrace(level = MessageLevel.ERROR)
Exception e);
 
     @Message(level = MessageLevel.ERROR,
-             text = "Encountered an error during cluster {0} discovery: {1}")
+             text = "Encountered an error during cluster ({0}) discovery: {1}")
     void clusterDiscoveryError(final String clusterName, @StackTrace(level = MessageLevel.DEBUG)
Exception e);
 
+    @Message(level = MessageLevel.ERROR,
+        text = "Failed to access the service configurations for cluster ({0}) discovery")
+    void failedToAccessServiceConfigs(final String clusterName);
 
     @Message(level = MessageLevel.ERROR,
              text = "REST invocation {0} timed out")
     void restInvocationTimedOut(final String url, @StackTrace(level = MessageLevel.DEBUG)
Exception e);
 
-
     @Message(level = MessageLevel.DEBUG,
              text = "REST invocation {0} failed: {1}")
     void restInvocationError(final String url, @StackTrace(level = MessageLevel.DEBUG) Exception
e);
 
-
     @Message(level = MessageLevel.ERROR,
             text = "No address for Ambari service discovery has been configured.")
     void missingDiscoveryAddress();

http://git-wip-us.apache.org/repos/asf/knox/blob/06df07ec/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java
b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java
index 6b81356..1a92cfd 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java
@@ -65,7 +65,7 @@ class PropertyEqualsHandler implements ConditionalValueHandler {
             }
 
             if (result == null) {
-                if (propertyValue.equals(value)) {
+                if (propertyValue != null && propertyValue.equals(value)) {
                     result = affirmativeResult.evaluate(config, cluster);
                 } else if (negativeResult != null) {
                     result = negativeResult.evaluate(config, cluster);


Mime
View raw message