Adding error handling
Adding error handling in the server controller for: Sudo package is not pre-installed for sudo users. Server user or associated group is not listed in the sudoers file. Server user password required
This commit is contained in:
parent
ae681ad6d2
commit
43fd9d5d90
1 changed files with 6 additions and 0 deletions
|
|
@ -770,6 +770,12 @@ ErrorCode ServerController::isUserInSudo(const ServerCredentials &credentials, D
|
|||
|
||||
if (!stdOut.contains("sudo"))
|
||||
return ErrorCode::ServerUserNotInSudo;
|
||||
if (stdErr.contains("command not found"))
|
||||
return ErrorCode::SudoPackageIsNotPreinstalled;
|
||||
if (stdErr.contains("sudoers"))
|
||||
return ErrorCode::ServerUserNotInSudoers;
|
||||
if (stdErr.contains("password is required"))
|
||||
return ErrorCode::ServerUserPasswordRequired;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue