From 1f626bc3482d258dc16f4e972b0008a7da7d7bbd Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Tue, 7 Dec 2021 15:12:54 -0300 Subject: [PATCH] 18301: Fixes the issue by adding 0 as one of the default values to be ignored. Also, pre-sort mounts' key lists before comparison, just in case. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- services/api/app/models/container_request.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb index 4a580816cd..badb40ba5f 100644 --- a/services/api/app/models/container_request.rb +++ b/services/api/app/models/container_request.rb @@ -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 -- 2.30.2