mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 23:03:45 +02:00
Fix auto-deploy not throwing proper exception
This commit is contained in:
@@ -61,9 +61,12 @@ class DeploymentService
|
||||
*/
|
||||
public static function randomNode($location, array $not = [])
|
||||
{
|
||||
$useLocation = Models\Location::findOrFail($location);
|
||||
$node = Models\Node::where('location', $useLocation->id)->where('public', 1)->whereNotIn('id', $not)->inRandomOrder()->first();
|
||||
$useLocation = Models\Location::where('id', $location)->first();
|
||||
if (!$useLocation) {
|
||||
throw new DisplayException("The location passed was not valid and could not be found.");
|
||||
}
|
||||
|
||||
$node = Models\Node::where('location', $useLocation->id)->where('public', 1)->whereNotIn('id', $not)->inRandomOrder()->first();
|
||||
if (!$node) {
|
||||
throw new DisplayException("Unable to find a node in location {$useLocation->short} (id: {$useLocation->id}) that is available and has space.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user