[ARVADOS] updated: 1.1.3-83-gdccc9d0

Git user git at public.curoverse.com
Thu Feb 22 10:20:08 EST 2018


Summary of changes:
 services/api/app/models/collection.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

       via  dccc9d06a45b8f568d9bfaab54419eb2c4579bba (commit)
      from  dc97a019c2680c18fe1e82526f7a05c769711219 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit dccc9d06a45b8f568d9bfaab54419eb2c4579bba
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date:   Thu Feb 22 12:19:37 2018 -0300

    12707: Set default storage classes on collection creation
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 35d07ff..6018a27 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -19,6 +19,7 @@ class Collection < ArvadosModel
   serialize :storage_classes_confirmed, Array
 
   before_validation :default_empty_manifest
+  before_validation :default_storage_classes, on: :create
   before_validation :check_encoding
   before_validation :check_manifest_validity
   before_validation :check_signatures
@@ -451,6 +452,14 @@ class Collection < ArvadosModel
   end
 
   protected
+
+  def default_storage_classes
+    if self.storage_classes_desired.nil? || self.storage_classes_desired.empty?
+      self.storage_classes_desired = ["default"]
+    end
+    self.storage_classes_confirmed ||= []
+  end
+
   def portable_manifest_text
     self.class.munge_manifest_locators(manifest_text) do |match|
       if match[2] # size
@@ -492,7 +501,7 @@ class Collection < ArvadosModel
   end
 
   def ensure_storage_classes_desired_is_not_empty
-    if storage_classes_desired.length == 0
+    if self.storage_classes_desired.empty?
       raise ArvadosModel::PermissionDeniedError.new("storage_classes_desired shouldn't be empty")
     end
   end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list