Skip to content

Commit a4f6870

Browse files
authored
server: track reinstall failures differently from initial install failures (pterodactyl#4531)
1 parent 039ad4a commit a4f6870

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

app/Http/Controllers/Api/Remote/Servers/ServerInstallController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,18 @@ public function index(Request $request, string $uuid): JsonResponse
4848
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
4949
{
5050
$server = $this->repository->getByUuid($uuid);
51+
$status = null;
5152

52-
$status = $request->boolean('successful') ? null : Server::STATUS_INSTALL_FAILED;
53+
// Make sure the type of failure is accurate
54+
if (!$request->boolean('successful')) {
55+
$status = Server::STATUS_INSTALL_FAILED;
56+
57+
if ($request->boolean('reinstall')) {
58+
$status = Server::STATUS_REINSTALL_FAILED;
59+
}
60+
}
61+
62+
// Keep the server suspended if it's already suspended
5363
if ($server->status === Server::STATUS_SUSPENDED) {
5464
$status = Server::STATUS_SUSPENDED;
5565
}

app/Http/Requests/Api/Remote/InstallationDataRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function rules(): array
1515
{
1616
return [
1717
'successful' => 'present|boolean',
18+
'reinstall' => 'sometimes|boolean',
1819
];
1920
}
2021
}

app/Models/Server.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class Server extends Model
115115

116116
public const STATUS_INSTALLING = 'installing';
117117
public const STATUS_INSTALL_FAILED = 'install_failed';
118+
public const STATUS_REINSTALL_FAILED = 'reinstall_failed';
118119
public const STATUS_SUSPENDED = 'suspended';
119120
public const STATUS_RESTORING_BACKUP = 'restoring_backup';
120121

0 commit comments

Comments
 (0)