From 5a8dcfc830a71d28029254a14aa9a085b9a8af5a Mon Sep 17 00:00:00 2001 From: Temoc Rodriguez Date: Fri, 6 Oct 2017 07:57:02 -0700 Subject: Add fix for guard db on disable Added a fix so that the guard database is not attempted to be accessed while guard is set to disabled. The guard db access is done in the operations manager which has no context of guardat the moment. Because of this separation, the boolean must be grabbed from the PolicyEngine properties. We should consider some guard refactoring. Issue-ID: POLICY-296 Change-Id: Ida7a2a7c19e568b076731e0f04bdc8a9fd0fcb26 Signed-off-by: Temoc Rodriguez --- .../controlloop/eventmanager/ControlLoopOperationManager.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'controlloop/common/eventmanager/src/main/java') diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 6e57b5ef0..89b702d63 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -44,6 +44,7 @@ import org.onap.policy.controlloop.actor.vfc.VFCActorServiceProvider; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.controlloop.actor.so.SOActorServiceProvider; +import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.so.SOResponse; import org.onap.policy.vfc.VFCResponse; import org.slf4j.Logger; @@ -541,6 +542,12 @@ public class ControlLoopOperationManager implements Serializable { } private void storeOperationInDataBase(){ + // Only store in DB if enabled + boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngine.manager.getEnvironmentProperty("guard.disabled")); + if( !guardEnabled ){ + return; + } + // DB Properties Properties props = new Properties(); -- cgit 1.2.3-korg