incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@redhat.com
Subject [PATCH 2/4] * server.rb (firewalls/new_rule): raise a validation error if no source given
Date Sat, 20 Aug 2011 01:02:06 GMT
From: David Lutterkort <lutter@redhat.com>


Signed-off-by: David Lutterkort <lutter@redhat.com>
---
 server/server.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/server/server.rb b/server/server.rb
index 1b50476..e579eca 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -1148,7 +1148,11 @@ collection :firewalls do
       for i in (1..max_groups) do
         groups.merge!({params["group#{i}"]=>params["group#{i}owner"]})
       end
-      params.merge!( {'addresses' => addresses} ) ; params.merge!( {'groups' => groups}
)
+      params['addresses'] = addresses
+      params['groups'] = groups
+      if addresses.empty? && groups.empty?
+        raise Deltacloud::Validation::Failure.new(nil, "No sources. Specify at least one
source ip_address or group")
+      end
       driver.create_firewall_rule(credentials, params)
       @firewall = driver.firewall(credentials, {:id => params[:id]})
       status 201
-- 
1.7.6


Mime
View raw message