From d772f2492b83e38c6615f4e48d6c6253f7ef74bc Mon Sep 17 00:00:00 2001 From: huangxinan1990 <129277020+huangxinan1990@users.noreply.github.com> Date: Fri, 7 Apr 2023 17:13:22 +0800 Subject: [PATCH] fix: when sudo enable is false, execute command will failed (#13860) --- .../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; } /**