This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 4a38d41f2f591f55f0e477d2039fd18901b2c1a2
Author: Gabor Gyimesi <[email protected]>
AuthorDate: Wed Apr 20 18:24:07 2022 +0200

    MINIFICPP-1804 Remove "c2" operand from C2 update operation
    
    Closes #1307
    Signed-off-by: Marton Szasz <[email protected]>
---
 libminifi/include/c2/C2Agent.h   |  3 ---
 libminifi/include/c2/C2Payload.h |  3 +--
 libminifi/src/c2/C2Agent.cpp     | 23 -----------------------
 3 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/libminifi/include/c2/C2Agent.h b/libminifi/include/c2/C2Agent.h
index b8fcb9ee7..38b33c03a 100644
--- a/libminifi/include/c2/C2Agent.h
+++ b/libminifi/include/c2/C2Agent.h
@@ -229,9 +229,6 @@ class C2Agent : public state::UpdateController {
 
   std::shared_ptr<utils::file::FileSystem> filesystem_;
 
-  // shared pointer to the running c2 configuration.
-  std::shared_ptr<Configure> running_c2_configuration;
-
   std::mutex heartbeat_mutex;
 
   std::vector<std::unique_ptr<HeartbeatReporter>> heartbeat_protocols_;
diff --git a/libminifi/include/c2/C2Payload.h b/libminifi/include/c2/C2Payload.h
index f347de549..dfb21d457 100644
--- a/libminifi/include/c2/C2Payload.h
+++ b/libminifi/include/c2/C2Payload.h
@@ -60,8 +60,7 @@ SMART_ENUM(DescribeOperand,
 
 SMART_ENUM(UpdateOperand,
   (CONFIGURATION, "configuration"),
-  (PROPERTIES, "properties"),
-  (C2, "c2")
+  (PROPERTIES, "properties")
 )
 
 SMART_ENUM(TransferOperand,
diff --git a/libminifi/src/c2/C2Agent.cpp b/libminifi/src/c2/C2Agent.cpp
index 37c21f44f..4d1d55df6 100644
--- a/libminifi/src/c2/C2Agent.cpp
+++ b/libminifi/src/c2/C2Agent.cpp
@@ -70,8 +70,6 @@ C2Agent::C2Agent(core::controller::ControllerServiceProvider 
*controller,
       thread_pool_(2, false, nullptr, "C2 threadpool") {
   manifest_sent_ = false;
 
-  running_c2_configuration = std::make_shared<Configure>();
-
   last_run_ = std::chrono::steady_clock::now();
 
   if (nullptr != controller_) {
@@ -596,7 +594,6 @@ void C2Agent::handle_update(const C2ContentResponse &resp) {
     return;
   }
 
-  // we've been told to update something
   switch (operand.value()) {
     case UpdateOperand::CONFIGURATION: {
       handleConfigurationUpdate(resp);
@@ -605,26 +602,6 @@ void C2Agent::handle_update(const C2ContentResponse &resp) 
{
     case UpdateOperand::PROPERTIES: {
       handlePropertyUpdate(resp);
       break;
-    } case UpdateOperand::C2: {
-      // prior configuration options were already in place. thus
-      // we clear the map so that we don't go through replacing
-      // unnecessary objects.
-      running_c2_configuration->clear();
-
-      for (auto entry : resp.operation_arguments) {
-        bool can_update = true;
-        if (nullptr != update_service_) {
-          can_update = update_service_->canUpdate(entry.first);
-        }
-        if (can_update)
-          running_c2_configuration->set(entry.first, entry.second.to_string());
-      }
-
-      if (resp.operation_arguments.size() > 0)
-        configure(running_c2_configuration);
-      C2Payload response(Operation::ACKNOWLEDGE, 
state::UpdateState::FULLY_APPLIED, resp.ident, true);
-      enqueue_c2_response(std::move(response));
-      break;
     }
   }
 }

Reply via email to