deployServer: проверка sudo -n только для systemctl сервиса

This commit is contained in:
AidarKC 2026-05-02 19:06:31 +03:00
parent e921b06826
commit ef0cd2cb7d

View File

@ -43,11 +43,11 @@ public class IT_DeployRestartNoCleanNoTestsMain {
}
private static void ensureSudoNoPasswordOrThrow() {
int code = ssh("sudo -n true");
int code = ssh("sudo -n systemctl status " + SERVICE_NAME + " >/dev/null 2>&1");
if (code == 0) return;
throw new RuntimeException(
"Remote sudo requires password for " + REMOTE_USER + "@" + REMOTE_HOST
+ ". Configure NOPASSWD for service control or run deploy with privileged user."
+ ". Configure NOPASSWD for 'systemctl ... " + SERVICE_NAME + "' or run deploy with privileged user."
);
}