18301: Fixes the issue by adding 0 as one of the default values to be ignored.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 7 Dec 2021 18:12:54 +0000 (15:12 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 7 Dec 2021 18:12:54 +0000 (15:12 -0300)
Also, pre-sort mounts' key lists before comparison, just in case.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

services/api/app/models/container_request.rb

index 4a580816cd737674966781d63dfee9a1b4a1dbee..badb40ba5fe7ff5ce3cf432f615a02147cb7b367 100644 (file)
@@ -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