[ARVADOS] updated: 2.1.0-226-gcd1329fba

Git user git at public.arvados.org
Wed Dec 30 19:21:03 UTC 2020


Summary of changes:
 services/api/app/models/arvados_model.rb     | 14 +++++++++-----
 services/api/app/models/container_request.rb |  4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)

       via  cd1329fbada00e83578725a77d1b59433061c655 (commit)
      from  6e8af911900eaf3e402c45405353cb740c580cf2 (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 cd1329fbada00e83578725a77d1b59433061c655
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Dec 30 16:20:27 2020 -0300

    17014: Fixes one last unit test.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index e12ed4b89..2a9e4e980 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -16,6 +16,7 @@ class ArvadosModel < ApplicationRecord
   include DbCurrentTime
   extend RecordFilters
 
+  after_find :set_zero_values
   after_find :schedule_restoring_changes
   after_initialize :log_start_state
   before_save :ensure_permission_to_save
@@ -31,7 +32,6 @@ class ArvadosModel < ApplicationRecord
   before_validation :normalize_collection_uuids
   before_validation :set_default_owner
   validate :ensure_valid_uuids
-  after_find :set_defaults
 
   # Note: This only returns permission links. It does not account for
   # permissions obtained via user.is_admin or
@@ -47,13 +47,17 @@ class ArvadosModel < ApplicationRecord
   # penalty.
   attr_accessor :async_permissions_update
 
-  # set_defaults will fill out default values that are not in the database
-  # this is meant to be implemented in the children as needed.
-  def set_defaults
+  # Fill out zero values that are not in the database
+  # this is meant to be implemented in the subclasses as needed.
+  def set_zero_values
     ## to do this correctly this is an example:
     ## attributes["runtime_constraints"]["keep_cache_ram"] = 0
     ## self.clear_attribute_changes(["runtime_constraints"])
-    ## super  # <- we should call arvados_model's set_defaults() 
+    ## super  # <- we should call arvados_model's set_zero_values()
+
+    # Having read the `attributes`, makes serializable attrs to be seen as changed
+    # even if they aren't
+    self.clear_attribute_changes(changes.keys)
   end
 
   # Ignore listed attributes on mass assignments
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 350621544..7012c1c32 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -464,8 +464,8 @@ class ContainerRequest < ArvadosModel
     super(permitted)
   end
 
-  def set_defaults
-    # this will fill out default values that are not in the database,
+  def set_zero_values
+    # this will fill out zero values that are not in the database,
     # see https://dev.arvados.org/issues/17014#note-28 for details
 
     AttrsRuntimeConstraintsDefaults.each do |key, value|

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list