mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-08 11:38:37 +02:00
Server creation: Only get node_id from allocation if it is missing (#1598)
This commit is contained in:
parent
46934d7a85
commit
795cad43b9
@ -56,8 +56,8 @@ class ServerCreationService
|
|||||||
$egg = Egg::query()->findOrFail($data['egg_id']);
|
$egg = Egg::query()->findOrFail($data['egg_id']);
|
||||||
|
|
||||||
// Fill missing fields from egg
|
// Fill missing fields from egg
|
||||||
$data['image'] = $data['image'] ?? collect($egg->docker_images)->first();
|
$data['image'] ??= collect($egg->docker_images)->first();
|
||||||
$data['startup'] = $data['startup'] ?? $egg->startup;
|
$data['startup'] ??= $egg->startup;
|
||||||
|
|
||||||
// If a deployment object has been passed we need to get the allocation and node that the server should use.
|
// If a deployment object has been passed we need to get the allocation and node that the server should use.
|
||||||
if ($deployment) {
|
if ($deployment) {
|
||||||
@ -87,7 +87,7 @@ class ServerCreationService
|
|||||||
$data['node_id'] = $nodes->first();
|
$data['node_id'] = $nodes->first();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$data['node_id'] = Allocation::find($data['allocation_id'])?->node_id;
|
$data['node_id'] ??= Allocation::find($data['allocation_id'])?->node_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert::false(empty($data['node_id']), 'Expected a non-empty node_id in server creation data.');
|
Assert::false(empty($data['node_id']), 'Expected a non-empty node_id in server creation data.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user