18301: Fixes the issue by adding 0 as one of the default values to be ignored.
[arvados.git] / services / api / app / models / container_request.rb
index 1de71102c61befff8e0aabef5885e7396405a237..badb40ba5fe7ff5ce3cf432f615a02147cb7b367 100644 (file)
@@ -23,7 +23,7 @@ class ContainerRequest < ArvadosModel
   # already know how to properly treat them.
   attribute :properties, :jsonbHash, default: {}
   attribute :secret_mounts, :jsonbHash, default: {}
-  attribute :output_storage_classes, :jsonbArray, default: ["default"]
+  attribute :output_storage_classes, :jsonbArray, default: lambda { Rails.configuration.DefaultStorageClasses }
 
   serialize :environment, Hash
   serialize :mounts, Hash
@@ -401,13 +401,13 @@ class ContainerRequest < ArvadosModel
     if self.new_record? || self.state_was == Uncommitted
       # Allow create-and-commit in a single operation.
       permitted.push(*AttrsPermittedBeforeCommit)
-    elsif mounts_changed? && mounts_was.keys == mounts.keys
+    elsif mounts_changed? && mounts_was.keys.sort == mounts.keys.sort
       # Ignore the updated mounts if the only changes are default/zero
       # values as added by controller, see 17774
       only_defaults = true
       mounts.each do |path, mount|
         (mount.to_a - mounts_was[path].to_a).each do |k, v|
-          if !["", false, nil].index(v)
+          if ![0, "", false, nil].index(v)
             only_defaults = false
           end
         end