deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject git commit: RHEV-M: Report instance name too long as 400 error
Date Thu, 08 Mar 2012 12:24:44 GMT
Updated Branches:
  refs/heads/master 5c9c84189 -> d48805405


RHEV-M: Report instance name too long as 400 error


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/d4880540
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/d4880540
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/d4880540

Branch: refs/heads/master
Commit: d488054051d98699a7f43669c5ed2e97b3173688
Parents: 5c9c841
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Mar 8 13:25:42 2012 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Thu Mar 8 13:25:42 2012 +0100

----------------------------------------------------------------------
 .../lib/deltacloud/drivers/rhevm/rhevm_driver.rb   |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d4880540/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 8a0764c..dfe77b3 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -177,10 +177,10 @@ class RHEVMDriver < Deltacloud::BaseDriver
   def create_instance(credentials, image_id, opts={})
     client = new_client(credentials)
     params = {}
-    if opts[:name]
-      raise "Parameter name must be #{USER_NAME_MAX} characters or less" if opts[:name].length
> USER_NAME_MAX
-    end
     safely do
+      if opts[:name]
+        raise "Parameter name must be #{USER_NAME_MAX} characters or less" if opts[:name].length
> USER_NAME_MAX
+      end
       params[:name] = opts[:name]
       params[:template] = opts[:image_id]
       params[:cluster] = opts[:realm_id] if opts[:realm_id]
@@ -327,10 +327,6 @@ class RHEVMDriver < Deltacloud::BaseDriver
 
   exceptions do
 
-    on /Bad Request/ do
-      status 400
-    end
-
     on /Unauthorized/ do
       status 401
     end
@@ -351,7 +347,7 @@ class RHEVMDriver < Deltacloud::BaseDriver
       status 500
     end
 
-    on /Parameter name/ do
+    on /(Bad Request|Parameter name)/ do
       status 400
     end
 


Mime
View raw message