incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@redhat.com
Subject [PATCH 1/6] ec2_driver (create_instance): make sure we do not double-encode user_data
Date Wed, 28 Sep 2011 22:28:31 GMT
From: David Lutterkort <lutter@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 <lutter@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


Mime
View raw message