You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2023/04/10 02:58:31 UTC

[dolphinscheduler] 02/02: fix: when sudo enable is false, execute command will failed (#13860)

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

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

commit 0df149c370508acbf476c4f20834326aa20da786
Author: huangxinan1990 <12...@users.noreply.github.com>
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;
     }
 
     /**