incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1178391 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
Date Mon, 03 Oct 2011 12:40:31 GMT
Author: mfojtik
Date: Mon Oct  3 12:40:29 2011
New Revision: 1178391

URL: http://svn.apache.org/viewvc?rev=1178391&view=rev
Log:
ec2_driver (create_instance): simplify the code a bit

Signed-off-by: David Lutterkort <lutter@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1178391&r1=1178390&r2=1178391&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Mon Oct  3
12:40:29 2011
@@ -215,20 +215,20 @@ module Deltacloud
           if opts[:user_data]
             instance_options[:user_data] = Base64::decode64(opts[:user_data])
           end
-          instance_options.merge!(:key_name => opts[:keyname]) if opts[:keyname]
-          instance_options.merge!(:availability_zone => opts[:realm_id]) if opts[:realm_id]
-          instance_options.merge!(:instance_type => opts[:hwp_id]) if opts[:hwp_id] &&
opts[:hwp_id].length > 0
+          instance_options[:key_name] = opts[:keyname] if opts[:keyname]
+          instance_options[:availability_zone] = opts[:realm_id] if opts[:realm_id]
+          instance_options[:instance_type] = opts[:hwp_id] if opts[:hwp_id] && opts[:hwp_id].length
> 0
           firewalls = opts.inject([]){|res, (k,v)| res << v if k =~ /firewalls\d+$/;
res}
-          instance_options.merge!(:group_ids => firewalls ) unless firewalls.empty?
-          instance_options.merge!(
-            :min_count => opts[:instance_count],
-            :max_count => opts[:instance_count]
-          ) if opts[:instance_count] and opts[:instance_count].length!=0
+          instance_options[:group_ids] = firewalls unless firewalls.empty?
+          if opts[:instance_count] and opts[:instance_count].length != 0
+            instance_options[:min_count] = opts[:instance_count]
+            instance_options[:max_count] = opts[:instance_count]
+          end
           if opts[:snapshot_id] and opts[:device_name]
-            instance_options.merge!(:block_device_mappings => [{
+            instance_options[:block_device_mappings] = [{
               :snapshot_id => opts[:snapshot_id],
               :device_name => opts[:device_name]
-            }])
+            }]
           end
           safely do
             new_instance = convert_instance(ec2.launch_instances(image_id, instance_options).first)



Mime
View raw message