You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2011/09/29 00:32:29 UTC

[PATCH 1/7] ec2_driver (create_instance): make sure we do not double-encode user_data

From: David Lutterkort <lu...@redhat.com>

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>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 736887b..857eb81 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -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
-- 
1.7.6