From 5fdb0a590905a2f6866a99d5096ff38c8341a3aa Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Mon, 13 Sep 2021 21:02:12 -0700 Subject: [PATCH] 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,