KNOX-1317 - Ambari service discovery config handling of nested derived properties
authorPhil Zampino <pzampino@apache.org>
Thu, 17 May 2018 13:19:54 +0000 (09:19 -0400)
committerPhil Zampino <pzampino@apache.org>
Thu, 17 May 2018 13:19:54 +0000 (09:19 -0400)
gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/PropertyEqualsHandler.java

index 0dfab36..6b81356 100644 (file)
@@ -43,7 +43,17 @@ class PropertyEqualsHandler implements ConditionalValueHandler {
 
         ServiceURLPropertyConfig.Property p = config.getConfigProperty(serviceName, propertyName);
         if (p != null) {
-            String value = getActualPropertyValue(cluster, p);
+
+            String value = null;
+            if (p.getType().equalsIgnoreCase(ServiceURLPropertyConfig.Property.TYPE_DERIVED)) {
+                ConditionalValueHandler valueHandler = p.getConditionHandler();
+                if (valueHandler != null) {
+                    value = valueHandler.evaluate(config, cluster);
+                }
+            } else {
+                value = getActualPropertyValue(cluster, p);
+            }
+
             if (propertyValue == null) {
                 // If the property value isn't specified, then we're just checking if the property is set with any value
                 if (value != null) {