From 01b6544ca5150567066afd7943810746f0ede156 Mon Sep 17 00:00:00 2001 From: Ned Wright Date: Sun, 16 Jul 2023 12:51:20 +0000 Subject: [PATCH] Fix manifest handling --- .../manifest_controller/manifest_controller.cc | 11 ++++++++--- .../security_apps/orchestration/orchestration_comp.cc | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/security_apps/orchestration/manifest_controller/manifest_controller.cc b/components/security_apps/orchestration/manifest_controller/manifest_controller.cc index f48fa51..7d5ae76 100755 --- a/components/security_apps/orchestration/manifest_controller/manifest_controller.cc +++ b/components/security_apps/orchestration/manifest_controller/manifest_controller.cc @@ -160,16 +160,21 @@ ManifestController::Impl::updateManifest(const string &new_manifest_file) { auto i_env = Singleton::Consume::by(); auto span_scope = i_env->startNewSpanScope(Span::ContextType::CHILD_OF); + auto orchestration_tools = Singleton::Consume::by(); - if (isIgnoreFile(new_manifest_file)) return true; + if (isIgnoreFile(new_manifest_file)) { + if (!orchestration_tools->copyFile(new_manifest_file, manifest_file_path)) { + dbgWarning(D_ORCHESTRATOR) << "Failed to copy a new manifest file"; + return false; + } + return true; + } dbgDebug(D_ORCHESTRATOR) << "Starting to update manifest file"; auto ignored_settings_packages = getProfileAgentSetting("orchestration.IgnoredPackagesList"); set packages_to_ignore = ignore_packages; if (ignored_settings_packages.ok()) packages_to_ignore = *(*ignored_settings_packages); - auto orchestration_tools = Singleton::Consume::by(); - if (packages_to_ignore.count("all") > 0) { dbgTrace(D_ORCHESTRATOR) << "Nothing to update (\"ignore all\" turned on)"; diff --git a/components/security_apps/orchestration/orchestration_comp.cc b/components/security_apps/orchestration/orchestration_comp.cc index 49cb0af..23d3c5a 100755 --- a/components/security_apps/orchestration/orchestration_comp.cc +++ b/components/security_apps/orchestration/orchestration_comp.cc @@ -1087,7 +1087,8 @@ private: vector data_updates; update_results[OrchestrationStatusConfigType::DATA] = handleDataUpdate(orch_data, data_updates); - if (!orch_manifest.ok() && orch_policy.ok()) { + auto orch_mode = agent_details->getOrchestrationMode(); + if ((!orch_manifest.ok() || orch_mode == OrchestrationMode::HYBRID) && orch_policy.ok()) { update_results[OrchestrationStatusConfigType::POLICY] = handlePolicyUpdate( orch_policy, settings_path,