[ARVADOS] updated: b29b5f97cf4f571114d0c73794b508d65af4331c

git at public.curoverse.com git at public.curoverse.com
Fri Jan 17 15:22:19 EST 2014


Summary of changes:
 .../api/app/controllers/application_controller.rb  |    9 ++++++---
 services/api/app/models/authorized_key.rb          |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

       via  b29b5f97cf4f571114d0c73794b508d65af4331c (commit)
       via  906a43f38efe61f049fda03ff28f407837193a7a (commit)
       via  b2d3257922b14b44ab628260f1fb51a68bef95a2 (commit)
      from  0e847d07bd66e554822eb0854bbaee312eeba839 (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 b29b5f97cf4f571114d0c73794b508d65af4331c
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jan 17 12:20:21 2014 -0800

    Tweak error messages to render nicely as Rails "full messages".
    
    "Public key does not appear to be ..."
    
    refs #1880

diff --git a/services/api/app/models/authorized_key.rb b/services/api/app/models/authorized_key.rb
index 2b30d4b..14db0b1 100644
--- a/services/api/app/models/authorized_key.rb
+++ b/services/api/app/models/authorized_key.rb
@@ -36,11 +36,11 @@ class AuthorizedKey < ArvadosModel
       key = /ssh-rsa [A-Za-z0-9+\/]+/.match(self.public_key)
       
       if not key
-        errors.add(:public_key, "Does not appear to be a valid ssh-rsa key")
+        errors.add(:public_key, "does not appear to be a valid ssh-rsa key")
       else
         # Valid if no other rows have this public key
         if self.class.where('public_key like ?', "%#{key[0]}%").any?
-          errors.add(:public_key, "Key already exists in the database, use a different key.")
+          errors.add(:public_key, "already exists in the database, use a different key.")
           return false
         end
       end

commit 906a43f38efe61f049fda03ff28f407837193a7a
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jan 17 12:19:34 2014 -0800

    Use render_error instead of custom error logic in update method.

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 5d698e7..4ec0241 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -50,7 +50,7 @@ class ApplicationController < ActionController::Base
     if @object.update_attributes attrs_to_update
       show
     else
-      render json: { errors: @object.errors.full_messages }, status: 422
+      render_error "Update failed"
     end
   end
 

commit b2d3257922b14b44ab628260f1fb51a68bef95a2
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jan 17 12:17:54 2014 -0800

    Respond with an error status if save fails during create method.
    
    refs #1880

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index c2a117b..5d698e7 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -33,8 +33,11 @@ class ApplicationController < ActionController::Base
 
   def create
     @object = model_class.new resource_attrs
-    @object.save
-    show
+    if @object.save
+      show
+    else
+      render_error "Save failed"
+    end
   end
 
   def update

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list