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

wenweihuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new a6d5fae18b [INLONG-9999][Agent] Handle scenarios where the module list 
is empty to prevent accidental deletion (#10000)
a6d5fae18b is described below

commit a6d5fae18b4828f009653da08d376ca888872697
Author: justinwwhuang <[email protected]>
AuthorDate: Wed Apr 17 18:51:28 2024 +0800

    [INLONG-9999][Agent] Handle scenarios where the module list is empty to 
prevent accidental deletion (#10000)
---
 .../java/org/apache/inlong/agent/installer/ModuleManager.java     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
index e7a375cfb6..dd438ed02a 100755
--- 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
+++ 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
@@ -115,6 +115,10 @@ public class ModuleManager extends AbstractDaemon {
         if (config == null) {
             return;
         }
+        if (config.getModuleList().isEmpty()) {
+            LOGGER.error("module list should not be empty!");
+            return;
+        }
         configQueue.clear();
         for (int i = 0; i < config.getModuleList().size(); i++) {
             LOGGER.info("submitModules index {} total {} {}", i, 
config.getModuleList().size(),
@@ -405,6 +409,10 @@ public class ModuleManager extends AbstractDaemon {
 
     private boolean isProcessAllStarted(ModuleConfig module) {
         String ret = ExcuteLinux.exeCmd(module.getCheckCommand());
+        if (ret == null) {
+            LOGGER.error("get module process num {} failed", module.getName());
+            return false;
+        }
         String[] processArray = ret.split("\n");
         int cnt = 0;
         for (int i = 0; i < processArray.length; i++) {

Reply via email to