From bc254688029e612a29f45b9c496e284aa44887d8 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sun, 12 Sep 2021 23:18:17 -0600 Subject: [PATCH 1/3] server: fix build modification not being persisted (#3610) --- app/Services/Servers/BuildModificationService.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 86658c6e8..66eb52235 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -56,8 +56,6 @@ class BuildModificationService */ public function handle(Server $server, array $data) { - $this->connection->beginTransaction(); - /** @var \Pterodactyl\Models\Server $server */ $server = $this->connection->transaction(function() use ($server, $data) { $this->processAllocations($server, $data); @@ -87,7 +85,7 @@ class BuildModificationService // Because Wings always fetches an updated configuration from the Panel when booting // a server this type of exception can be safely "ignored" and just written to the logs. - // Ideally this request succeedes so we can apply resource modifications on the fly, but + // Ideally this request succeeds, so we can apply resource modifications on the fly, but // if it fails we can just continue on as normal. if (!empty($updateData['build'])) { try { From f5a1ce13b80dbaf08ed5184725d289faa4f907e1 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 13 Sep 2021 20:47:30 -0700 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec20cf013..0089ee4f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v1.6.1 +### Fixed +* Fixes server build modifications not being properly persisted to the database when edited. + ## v1.6.0 ### Fixed * Fixes array merging logic for server transfers that would cause a 500 error to occur in some scenarios. From 5fdb0a590905a2f6866a99d5096ff38c8341a3aa Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 13 Sep 2021 21:02:12 -0700 Subject: [PATCH 3/3] Correctly expose OOM disable state for a server --- CHANGELOG.md | 3 ++- app/Services/Servers/ServerConfigurationStructureService.php | 4 ++++ app/Transformers/Api/Application/ServerTransformer.php | 1 + app/Transformers/Api/Client/ServerTransformer.php | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0089ee4f1..9b3da3007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ## v1.6.1 ### Fixed * Fixes server build modifications not being properly persisted to the database when edited. - +* Correctly exposes the `oom_disabled` field in the `build` limits block for a server build so that Wings can pick it up. +* ## v1.6.0 ### Fixed * Fixes array merging logic for server transfers that would cause a 500 error to occur in some scenarios. diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index c94155bf0..8d68d7de8 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -58,9 +58,13 @@ class ServerConfigurationStructureService 'cpu_limit' => $server->cpu, 'threads' => $server->threads, 'disk_space' => $server->disk, + 'oom_disabled' => $server->oom_disabled, ], 'container' => [ 'image' => $server->image, + // This field is deprecated — use the value in the "build" block. + // + // TODO: remove this key in V2. 'oom_disabled' => $server->oom_disabled, 'requires_rebuild' => false, ], diff --git a/app/Transformers/Api/Application/ServerTransformer.php b/app/Transformers/Api/Application/ServerTransformer.php index c1d33e06d..f51638022 100644 --- a/app/Transformers/Api/Application/ServerTransformer.php +++ b/app/Transformers/Api/Application/ServerTransformer.php @@ -69,6 +69,7 @@ class ServerTransformer extends BaseTransformer 'io' => $server->io, 'cpu' => $server->cpu, 'threads' => $server->threads, + 'oom_disabled' => $server->oom_disabled, ], 'feature_limits' => [ 'databases' => $server->database_limit, diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 99771e676..c8c10a9b2 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -55,6 +55,8 @@ class ServerTransformer extends BaseClientTransformer 'disk' => $server->disk, 'io' => $server->io, 'cpu' => $server->cpu, + 'threads' => $server->threads, + 'oom_disabled' => $server->oom_disabled, ], 'invocation' => $service->handle($server, !$this->getUser()->can(Permission::ACTION_STARTUP_READ, $server)), 'docker_image' => $server->image,