Fix auto-deploy not throwing proper exception
This commit is contained in:
parent
b850256657
commit
9d55e93e9e
2 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
* File manager rename field would not disappear when pressing the escape key in chrome. [#121](https://github.com/Pterodactyl/Panel/issues/121)
|
* File manager rename field would not disappear when pressing the escape key in chrome. [#121](https://github.com/Pterodactyl/Panel/issues/121)
|
||||||
* Fixes bug where server image assigned was not being saved to the database.
|
* Fixes bug where server image assigned was not being saved to the database.
|
||||||
* Fixes instances where selecting auto-deploy would not hide the node selection dropdown.
|
* Fixes instances where selecting auto-deploy would not hide the node selection dropdown.
|
||||||
|
* Fixes bug in auto-deployment that would throw a `ModelNotFoundException` if the location passed was not valid. Not normally an issue in the panel, but caused display isses for the API.
|
||||||
|
|
||||||
## v0.5.0-pre.1 (Bodacious Boreopterus)
|
## v0.5.0-pre.1 (Bodacious Boreopterus)
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,12 @@ class DeploymentService
|
||||||
*/
|
*/
|
||||||
public static function randomNode($location, array $not = [])
|
public static function randomNode($location, array $not = [])
|
||||||
{
|
{
|
||||||
$useLocation = Models\Location::findOrFail($location);
|
$useLocation = Models\Location::where('id', $location)->first();
|
||||||
$node = Models\Node::where('location', $useLocation->id)->where('public', 1)->whereNotIn('id', $not)->inRandomOrder()->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) {
|
if (!$node) {
|
||||||
throw new DisplayException("Unable to find a node in location {$useLocation->short} (id: {$useLocation->id}) that is available and has space.");
|
throw new DisplayException("Unable to find a node in location {$useLocation->short} (id: {$useLocation->id}) that is available and has space.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue