Throw exception if no allocation is there.
This commit is contained in:
parent
514512a40c
commit
b2cd7cc5c9
|
@ -104,7 +104,12 @@ class DeploymentService
|
|||
*/
|
||||
public static function randomAllocation($node)
|
||||
{
|
||||
return Models\Allocation::where('node', $node)->whereNull('assigned_to')->inRandomOrder()->first();
|
||||
$allocation = Models\Allocation::where('node', $node)->whereNull('assigned_to')->inRandomOrder()->first();
|
||||
if (!$allocation) {
|
||||
throw new DisplayException('No available allocation could be found for the assigned node.');
|
||||
}
|
||||
|
||||
return $allocation;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue