X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3aaefcb3c76ff470b475d950398d01255e87712a..b1daec9a928eefbc71d8b7368b148fa7b04bf32d:/services/api/app/models/collection.rb diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb index 4e7b64cf53..1bbe8cc661 100644 --- a/services/api/app/models/collection.rb +++ b/services/api/app/models/collection.rb @@ -17,7 +17,7 @@ class Collection < ArvadosModel # Posgresql JSONB columns should NOT be declared as serialized, Rails 5 # already know how to properly treat them. attribute :properties, :jsonbHash, default: {} - attribute :storage_classes_desired, :jsonbArray, default: ["default"] + attribute :storage_classes_desired, :jsonbArray, default: lambda { Rails.configuration.DefaultStorageClasses } attribute :storage_classes_confirmed, :jsonbArray, default: [] before_validation :default_empty_manifest @@ -150,7 +150,9 @@ class Collection < ArvadosModel def strip_signatures_and_update_replication_confirmed if self.manifest_text_changed? in_old_manifest = {} - if not self.replication_confirmed.nil? + # manifest_text_was could be nil when dealing with a freshly created snapshot, + # so we skip this case because there was no real manifest change. (Bug #18005) + if (not self.replication_confirmed.nil?) and (not self.manifest_text_was.nil?) self.class.each_manifest_locator(manifest_text_was) do |match| in_old_manifest[match[1]] = true end @@ -630,7 +632,7 @@ class Collection < ArvadosModel # validation on empty desired storage classes return an error. def default_storage_classes if self.storage_classes_desired.nil? || self.storage_classes_desired.empty? - self.storage_classes_desired = ["default"] + self.storage_classes_desired = Rails.configuration.DefaultStorageClasses end self.storage_classes_confirmed ||= [] end