[ARVADOS] updated: 2.1.0-223-g50601aa01

Git user git at public.arvados.org
Wed Dec 30 15:45:18 UTC 2020


Summary of changes:
 services/api/app/models/container_request.rb | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

       via  50601aa0129ef04a892256d4ede08ed8eb81db54 (commit)
      from  f693516a9f47903e791b3e1c918fcbb6ebf46110 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 50601aa0129ef04a892256d4ede08ed8eb81db54
Author: Nico Cesar <nico at nicocesar.com>
Date:   Wed Dec 30 10:45:00 2020 -0500

    Added set_defaults to arvados_model to handle zero value in attrs
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 8c1210ab9..ede4f47b4 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -460,17 +460,23 @@ class ContainerRequest < ArvadosModel
     # this will fill out default values that are not in the database,
     # see https://dev.arvados.org/issues/17014#note-28 for details
 
-    AttrsRuntimeConstraintsDefaults.each do |key, value|
-      if !self.runtime_constraints.key?(key)
-        attributes["runtime_constraints"][key] = value
+    if self.runtime_constraints?
+      AttrsRuntimeConstraintsDefaults.each do |key, value|
+        if !self.runtime_constraints.key?(key)
+          attributes["runtime_constraints"][key] = value
+          self.clear_attribute_changes(["runtime_constraints"])
+        end
       end
     end
-    AttrsSchedulingParametersDefaults.each do |key, value|
-      if !self.scheduling_parameters.key?(key)
-        attributes["scheduling_parameters"][key] = value
+    if self.scheduling_parameters?
+      AttrsSchedulingParametersDefaults.each do |key, value|
+        if !self.scheduling_parameters.key?(key)
+          attributes["scheduling_parameters"][key] = value
+        end
+        self.clear_attribute_changes("scheduling_parameters"])
       end
     end
-    self.clear_attribute_changes(["runtime_constraints","scheduling_parameters"])
+    
     super
   end
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list