[Bug][Worker] generate kill command with unknown user: default (#14145)

This commit is contained in:
Aaron Wang 2023-05-22 20:48:40 +08:00 committed by GitHub
parent 428f1559a3
commit 5e87b2d58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,7 @@
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.constants.TenantConstants;
import org.apache.dolphinscheduler.common.shell.ShellExecutor;
import oshi.SystemInfo;
@ -386,6 +387,8 @@ public class OSUtils {
if (!isSudoEnable() || StringUtils.isEmpty(tenantCode)) {
return command;
}
tenantCode = TenantConstants.DEFAULT_TENANT_CODE.equals(tenantCode) ? TenantConstants.BOOTSTRAPT_SYSTEM_USER
: tenantCode;
return String.format("sudo -u %s %s", tenantCode, command);
}