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

kerwin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new d772f2492b fix: when sudo enable is false, execute command will failed 
(#13860)
d772f2492b is described below

commit d772f2492b83e38c6615f4e48d6c6253f7ef74bc
Author: huangxinan1990 <[email protected]>
AuthorDate: Fri Apr 7 17:13:22 2023 +0800

    fix: when sudo enable is false, execute command will failed (#13860)
---
 .../java/org/apache/dolphinscheduler/plugin/task/api/utils/OSUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/OSUtils.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/OSUtils.java
index 7bb2b32561..f8bfeae494 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/OSUtils.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/OSUtils.java
@@ -39,7 +39,7 @@ public class OSUtils {
      * @return result of sudo execute command
      */
     public static String getSudoCmd(String tenantCode, String command) {
-        return StringUtils.isEmpty(tenantCode) ? command : "sudo -u " + 
tenantCode + " " + command;
+        return StringUtils.isEmpty(tenantCode) || !isSudoEnable() ? command : 
"sudo -u " + tenantCode + " " + command;
     }
 
     /**

Reply via email to