Release reserved allocations upon archive failure
This commit is contained in:
parent
01926e2896
commit
8d297a0918
1 changed files with 9 additions and 1 deletions
|
@ -112,10 +112,18 @@ class ServerTransferController extends Controller
|
|||
|
||||
// Unsuspend the server and don't continue the transfer.
|
||||
if (! $request->input('successful')) {
|
||||
$server->transfer->forceFill([
|
||||
$transfer = $server->transfer;
|
||||
|
||||
$transfer->forceFill([
|
||||
'successful' => false,
|
||||
])->saveOrFail();
|
||||
|
||||
$allocationIds = json_decode($transfer->new_additional_allocations);
|
||||
array_push($allocationIds, $transfer->new_allocation);
|
||||
|
||||
// Release the reserved allocations.
|
||||
$this->allocationRepository->updateWhereIn('id', $allocationIds, ['server_id' => null]);
|
||||
|
||||
return new JsonResponse([], Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue