server: track reinstall failures differently from initial install failures (#4531)
This commit is contained in:
parent
039ad4abf0
commit
a4f6870518
|
@ -48,8 +48,18 @@ class ServerInstallController extends Controller
|
||||||
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
|
public function store(InstallationDataRequest $request, string $uuid): JsonResponse
|
||||||
{
|
{
|
||||||
$server = $this->repository->getByUuid($uuid);
|
$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) {
|
if ($server->status === Server::STATUS_SUSPENDED) {
|
||||||
$status = Server::STATUS_SUSPENDED;
|
$status = Server::STATUS_SUSPENDED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class InstallationDataRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'successful' => 'present|boolean',
|
'successful' => 'present|boolean',
|
||||||
|
'reinstall' => 'sometimes|boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ class Server extends Model
|
||||||
|
|
||||||
public const STATUS_INSTALLING = 'installing';
|
public const STATUS_INSTALLING = 'installing';
|
||||||
public const STATUS_INSTALL_FAILED = 'install_failed';
|
public const STATUS_INSTALL_FAILED = 'install_failed';
|
||||||
|
public const STATUS_REINSTALL_FAILED = 'reinstall_failed';
|
||||||
public const STATUS_SUSPENDED = 'suspended';
|
public const STATUS_SUSPENDED = 'suspended';
|
||||||
public const STATUS_RESTORING_BACKUP = 'restoring_backup';
|
public const STATUS_RESTORING_BACKUP = 'restoring_backup';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue