1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

server: track reinstall failures differently from initial install failures (#4531)

This commit is contained in:
Lance Pioch 2022-11-21 15:53:54 -05:00 committed by GitHub
parent 039ad4abf0
commit a4f6870518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -48,8 +48,18 @@ class ServerInstallController extends Controller
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
{
$server = $this->repository->getByUuid($uuid);
$status = null;
$status = $request->boolean('successful') ? null : Server::STATUS_INSTALL_FAILED;
// Make sure the type of failure is accurate
if (!$request->boolean('successful')) {
$status = Server::STATUS_INSTALL_FAILED;
if ($request->boolean('reinstall')) {
$status = Server::STATUS_REINSTALL_FAILED;
}
}
// Keep the server suspended if it's already suspended
if ($server->status === Server::STATUS_SUSPENDED) {
$status = Server::STATUS_SUSPENDED;
}

View File

@ -15,6 +15,7 @@ class InstallationDataRequest extends FormRequest
{
return [
'successful' => 'present|boolean',
'reinstall' => 'sometimes|boolean',
];
}
}

View File

@ -115,6 +115,7 @@ class Server extends Model
public const STATUS_INSTALLING = 'installing';
public const STATUS_INSTALL_FAILED = 'install_failed';
public const STATUS_REINSTALL_FAILED = 'reinstall_failed';
public const STATUS_SUSPENDED = 'suspended';
public const STATUS_RESTORING_BACKUP = 'restoring_backup';