Moving checking for declarative

This commit is contained in:
root 2023-12-26 14:53:59 +00:00
parent d91a1c4ca5
commit 1eee88cba5

View File

@ -231,7 +231,6 @@ private:
auto orchestration_tools = Singleton::Consume<I_OrchestrationTools>::by<OrchestrationComp>(); auto orchestration_tools = Singleton::Consume<I_OrchestrationTools>::by<OrchestrationComp>();
if (orchestration_tools->doesFileExist(orchestration_policy_file)) { if (orchestration_tools->doesFileExist(orchestration_policy_file)) {
maybe_policy = loadOrchestrationPolicy(); maybe_policy = loadOrchestrationPolicy();
if (declarative) Singleton::Consume<I_DeclarativePolicy>::from<DeclarativePolicyUtils>()->turnOnApplyPolicyFlag();
if (!maybe_policy.ok()) { if (!maybe_policy.ok()) {
dbgWarning(D_ORCHESTRATOR) << "Failed to load Orchestration policy. Error: " << maybe_policy.getErr(); dbgWarning(D_ORCHESTRATOR) << "Failed to load Orchestration policy. Error: " << maybe_policy.getErr();
enforce_policy_flag = true; enforce_policy_flag = true;
@ -272,7 +271,6 @@ private:
if (enforce_policy_flag) { if (enforce_policy_flag) {
// Trying to create the Orchestration policy from the general policy file // Trying to create the Orchestration policy from the general policy file
maybe_policy = enforceOrchestrationPolicy(); maybe_policy = enforceOrchestrationPolicy();
if (declarative) Singleton::Consume<I_DeclarativePolicy>::from<DeclarativePolicyUtils>()->turnOnApplyPolicyFlag();
if (!maybe_policy.ok()) { if (!maybe_policy.ok()) {
return genError(maybe_policy.getErr()); return genError(maybe_policy.getErr());
} }
@ -298,6 +296,7 @@ private:
} }
} }
if (declarative) Singleton::Consume<I_DeclarativePolicy>::from<DeclarativePolicyUtils>()->turnOnApplyPolicyFlag();
return authentication_res; return authentication_res;
} }