deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1197136 - in /incubator/deltacloud/trunk/server/lib: deltacloud/validation.rb sinatra/rabbit.rb
Date Thu, 03 Nov 2011 14:25:48 GMT
Author: mfojtik
Date: Thu Nov  3 14:25:48 2011
New Revision: 1197136

URL: http://svn.apache.org/viewvc?rev=1197136&view=rev
Log:
Rabbit: Fixed validation error when switching drivers (BZ: #750920)

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb
    incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb?rev=1197136&r1=1197135&r2=1197136&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb Thu Nov  3 14:25:48 2011
@@ -84,14 +84,15 @@ module Deltacloud::Validation
     params.each_value { |p| yield p }
   end
 
-  def validate(all_params, values, credentials)
+  def validate(current_driver, all_params, values, credentials)
     all_params.each do |key, p|
       if p.required? and not values[p.name]
         raise Failure.new(p, "Required parameter #{p.name} not found")
       end
       next unless values[p.name]
       if p.hwp_property?
-        profile = driver.hardware_profile(credentials, values['hwp_id'])
+        profile = current_driver.hardware_profile(credentials, values['hwp_id'])
+        raise Failure.new(p, "Unknown hardware profile selected #{values['hwp_id']}") unless
profile
         unless p.valid_hwp_value?(profile, values[p.name])
           raise Failure.new(p, "Hardware profile property #{p.name} has invalid value #{values[p.name]}")
         end

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb?rev=1197136&r1=1197135&r2=1197136&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb Thu Nov  3 14:25:48 2011
@@ -121,7 +121,7 @@ module Sinatra
         @control = Proc.new do
           op.collection.check_supported(driver)
           op.check_capability(driver)
-          op.validate(op.effective_params(driver), params, credentials)
+          op.validate(driver, op.effective_params(driver), params, credentials)
           instance_eval(&block)
         end
       end



Mime
View raw message