X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/231a86fd3f7e30e9f66d71d92ad7c26578637e37..e6f2c5ddcd8b8faba1f27cd9890fe8f24e6b72c8:/services/api/app/models/collection.rb diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb index ac00e5d39c..8f724e1f5f 100644 --- a/services/api/app/models/collection.rb +++ b/services/api/app/models/collection.rb @@ -28,6 +28,7 @@ class Collection < ArvadosModel before_validation :check_signatures before_validation :strip_signatures_and_update_replication_confirmed before_validation :name_null_if_empty + validate :ensure_filesystem_compatible_name validate :ensure_pdh_matches_manifest_text validate :ensure_storage_classes_desired_is_not_empty validate :ensure_storage_classes_contain_non_empty_strings @@ -258,10 +259,10 @@ class Collection < ArvadosModel should_preserve_version = should_preserve_version? # Time sensitive, cache value return(yield) unless (should_preserve_version || syncable_updates.any?) - # Put aside the changes because with_lock forces a record reload + # Put aside the changes because with_lock requires an explicit record reload changes = self.changes snapshot = nil - with_lock do + reload.with_lock do # Copy the original state to save it as old version if should_preserve_version snapshot = self.dup @@ -521,7 +522,7 @@ class Collection < ArvadosModel joins("JOIN collections ON links.head_uuid = collections.uuid"). order("links.created_at DESC") - docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats + docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats.keys.map(&:to_s) if (docker_image_formats.include? 'v1' and docker_image_formats.include? 'v2') or filter_compatible_format == false @@ -623,10 +624,10 @@ class Collection < ArvadosModel return end (managed_props.keys - self.properties.keys).each do |key| - if managed_props[key].has_key?('Value') - self.properties[key] = managed_props[key]['Value'] - elsif managed_props[key]['Function'].andand == 'original_owner' + if managed_props[key]['Function'] == 'original_owner' self.properties[key] = self.user_owner_uuid + elsif managed_props[key]['Value'] + self.properties[key] = managed_props[key]['Value'] else logger.warn "Unidentified default property definition '#{key}': #{managed_props[key].inspect}" end