You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/10/03 14:40:15 UTC

svn commit: r1178390 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb

Author: mfojtik
Date: Mon Oct  3 12:40:14 2011
New Revision: 1178390

URL: http://svn.apache.org/viewvc?rev=1178390&view=rev
Log:
ec2_driver (create_instance): make sure we do not double-encode user_data

The client sends Base64 encoded data, which we hand to the AWS gem, which
will encode it again. That breaks people's expectations from other cloud
libraries, and the raw AWS API.

Signed-off-by: David Lutterkort <lu...@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=1178390&r1=1178389&r2=1178390&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:14 2011
@@ -212,7 +212,9 @@ module Deltacloud
         def create_instance(credentials, image_id, opts={})
           ec2 = new_client(credentials)
           instance_options = {}
-          instance_options.merge!(:user_data => opts[:user_data]) if opts[:user_data]
+          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