Pass the updated model through for updating node config, rather than old model, ref #1237
This commit is contained in:
parent
7ed9c7cb93
commit
3bb9bf04e5
|
@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
### Fixed
|
### Fixed
|
||||||
* Scheduled tasks triggered manually no longer improperly change the `next_run_at` time and do not run twice in a row anymore.
|
* Scheduled tasks triggered manually no longer improperly change the `next_run_at` time and do not run twice in a row anymore.
|
||||||
* Changing the maximum web-based file upload size for a node now properly validates and updates.
|
* Changing the maximum web-based file upload size for a node now properly validates and updates.
|
||||||
|
* Changing configuration values for a node now correctly updates them on the daemon on the first request, rather than requiring a second request to set them.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Egg and server variable values are no longer limited to 191 characters. Turns out some games require a large number of characters in these fields.
|
* Egg and server variable values are no longer limited to 191 characters. Turns out some games require a large number of characters in these fields.
|
||||||
|
|
|
@ -124,7 +124,7 @@ class NodeController extends ApplicationApiController
|
||||||
*/
|
*/
|
||||||
public function update(UpdateNodeRequest $request): array
|
public function update(UpdateNodeRequest $request): array
|
||||||
{
|
{
|
||||||
$node = $this->updateService->returnUpdatedModel()->handle(
|
$node = $this->updateService->handle(
|
||||||
$request->getModel(Node::class), $request->validated()
|
$request->getModel(Node::class), $request->validated()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ use Pterodactyl\Models\Node;
|
||||||
use GuzzleHttp\Exception\ConnectException;
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
use GuzzleHttp\Exception\RequestException;
|
||||||
use Illuminate\Database\ConnectionInterface;
|
use Illuminate\Database\ConnectionInterface;
|
||||||
use Pterodactyl\Traits\Services\ReturnsUpdatedModels;
|
|
||||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||||
use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
|
use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
|
||||||
|
@ -21,8 +20,6 @@ use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
|
||||||
|
|
||||||
class NodeUpdateService
|
class NodeUpdateService
|
||||||
{
|
{
|
||||||
use ReturnsUpdatedModels;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Illuminate\Database\ConnectionInterface
|
* @var \Illuminate\Database\ConnectionInterface
|
||||||
*/
|
*/
|
||||||
|
@ -74,14 +71,10 @@ class NodeUpdateService
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->connection->beginTransaction();
|
$this->connection->beginTransaction();
|
||||||
if ($this->getUpdatedModel()) {
|
$updatedModel = $this->repository->update($node->id, $data);
|
||||||
$response = $this->repository->update($node->id, $data);
|
|
||||||
} else {
|
|
||||||
$response = $this->repository->withoutFreshModel()->update($node->id, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->configRepository->setNode($node)->update();
|
$this->configRepository->setNode($updatedModel)->update();
|
||||||
$this->connection->commit();
|
$this->connection->commit();
|
||||||
} catch (RequestException $exception) {
|
} catch (RequestException $exception) {
|
||||||
// Failed to connect to the Daemon. Let's go ahead and save the configuration
|
// Failed to connect to the Daemon. Let's go ahead and save the configuration
|
||||||
|
@ -95,6 +88,6 @@ class NodeUpdateService
|
||||||
throw new DaemonConnectionException($exception);
|
throw new DaemonConnectionException($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $updatedModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue