Ignore feature conditions 22/51522/3
authorStephen Kitt <skitt@redhat.com>
Tue, 7 Feb 2017 15:34:23 +0000 (16:34 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 13 Feb 2017 20:00:35 +0000 (20:00 +0000)
Features whose name contains "-condition-" encode feature conditions;
for example, kar-condition-shell is the shell condition on the kar
feature. These features should never be processed by
FeatureConfigPusher.

Change-Id: Ic2ce2312fb347792d269d43d7bcb5f115905380f
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/config/config-persister-feature4-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java

index 50757fb7b90961df577d1dc1d7675bbf56ea8bb5..7f254d539337970a68a58c759b43c001e9bd6f7e 100644 (file)
@@ -75,9 +75,12 @@ public class FeatureConfigPusher {
 
     private Set<FeatureConfigSnapshotHolder> pushConfig(final Feature feature) throws Exception {
         Set<FeatureConfigSnapshotHolder> configs = new LinkedHashSet<>();
 
     private Set<FeatureConfigSnapshotHolder> pushConfig(final Feature feature) throws Exception {
         Set<FeatureConfigSnapshotHolder> configs = new LinkedHashSet<>();
-        if(isInstalled(feature)) {
+        // Ignore feature conditions — these encode conditions on other features and shouldn't be processed here
+        if (feature.getName().contains("-condition-")) {
+            LOG.debug("Ignoring conditional feature {}", feature);
+        } else if (isInstalled(feature)) {
             // FIXME Workaround for BUG-2836, features service returns null for feature: standard-condition-webconsole_0_0_0, 3.0.1
             // FIXME Workaround for BUG-2836, features service returns null for feature: standard-condition-webconsole_0_0_0, 3.0.1
-            if(featuresService.getFeature(feature.getName(), feature.getVersion()) == null) {
+            if (featuresService.getFeature(feature.getName(), feature.getVersion()) == null) {
                 LOG.debug("Feature: {}, {} is missing from features service. Skipping", feature.getName(), feature.getVersion());
             } else {
                 ChildAwareFeatureWrapper wrappedFeature = new ChildAwareFeatureWrapper(feature, featuresService);
                 LOG.debug("Feature: {}, {} is missing from features service. Skipping", feature.getName(), feature.getVersion());
             } else {
                 ChildAwareFeatureWrapper wrappedFeature = new ChildAwareFeatureWrapper(feature, featuresService);