Project

General

Profile

Actions

Bug #17299

closed

[controller] runtime_constraints should be spelled {API:true}, not {api:true}

Added by Tom Clegg about 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Story points:
-
Release relationship:
Auto

Description

In #17014 3ec51dcf456b2afe02857089895a261653abddd4 did this

 type RuntimeConstraints struct {
-       API          *bool
+       API          bool  `json:"api"`

and this

+    self.runtime_constraints = {
+      'api' => false,
+      'keep_cache_ram' => 0,
+      'ram' => 0,
+      'vcpus' => 0,
+    }.merge(attributes['runtime_constraints'] || {})
As a result:
  • when a client submits a CR with {"runtime_constraints":{"API":true}}, controller changes it to {"api":true}
  • when railsapi loads a CR from the database that has {"API":true}, it merges with the default {"api":false} and returns {"api":false,"API":true} to the caller and/or the updated database row, which is obviously bad and (sometimes?) causes crunchrun to use the wrong value.
To fix:
  • change the key back to "API" in the Go SDK
  • change the key to "API" in the Rails merge-with-default code

A benefit of #17014 is that (with the above fix) railsapi won't see "api" no matter what the client sends -- controller will rewrite it as "API" -- so we shouldn't need any extra checks to prevent future problems.


Subtasks 1 (0 open1 closed)

Task #17302: ReviewResolvedNico César02/03/2021Actions
Actions #1

Updated by Nico César about 3 years ago

  • Assigned To set to Nico César
  • Status changed from New to In Progress
Actions #3

Updated by Nico César about 3 years ago

Actions #4

Updated by Tom Clegg about 3 years ago

LGTM, thanks!

Actions #5

Updated by Peter Amstutz about 3 years ago

  • Status changed from In Progress to Resolved
Actions #6

Updated by Peter Amstutz almost 3 years ago

  • Release set to 38
Actions

Also available in: Atom PDF