deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [19/50] [abbrv] git commit: EC2: Minor improvements to EC2 frontned parser
Date Mon, 30 Jul 2012 14:29:17 GMT
EC2: Minor improvements to EC2 frontned parser

* ActionHandler now advertise mappings using 'mappings' method
* deltacloud_method_params now survive repetetive calls


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

Branch: refs/heads/master
Commit: 11034410e78d2100cea7421c81d425bb49e21a7b
Parents: 41ea5de
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Jul 26 15:51:00 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Jul 27 14:05:41 2012 +0200

----------------------------------------------------------------------
 server/lib/ec2/query_parser.rb |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/11034410/server/lib/ec2/query_parser.rb
----------------------------------------------------------------------
diff --git a/server/lib/ec2/query_parser.rb b/server/lib/ec2/query_parser.rb
index 8050119..2098d24 100644
--- a/server/lib/ec2/query_parser.rb
+++ b/server/lib/ec2/query_parser.rb
@@ -31,6 +31,10 @@ module Deltacloud::EC2
       :terminate_instances => { :method => :destroy_instance, :params => { 'InstanceId.1'
=> :id }},
     }
 
+    def self.mappings
+      MAPPINGS
+    end
+
     attr_reader :action
 
     def initialize(action)
@@ -38,12 +42,13 @@ module Deltacloud::EC2
     end
 
     def deltacloud_method
-      MAPPINGS[action.action][:method]
+      self.class.mappings[action.action][:method]
     end
 
     def deltacloud_method_params
-      MAPPINGS[action.action][:params].inject({}) do |result, p|
-        result[p.last] = action.parameters.delete(p.first)
+      parameters = action.parameters.dup
+      self.class.mappings[action.action][:params].inject({}) do |result, p|
+        result[p.last] = parameters.delete(p.first)
         result.delete_if { |k,v| v.nil? }
       end
     end
@@ -137,7 +142,7 @@ module Deltacloud::EC2
     end
 
     def valid_actions
-      ActionHandler::MAPPINGS.keys
+      ActionHandler::mappings.keys
     end
 
     def valid_action?


Mime
View raw message