From 5053b3e357679d827c876a4bf8352a876a6462ba Mon Sep 17 00:00:00 2001 From: Wesley Beary Date: Wed, 21 Oct 2009 14:50:27 -0700 Subject: [PATCH] move Base64 encoding stuff down to low level calls --- lib/fog/aws/models/ec2/instance.rb | 3 +-- lib/fog/aws/requests/ec2/run_instances.rb | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/models/ec2/instance.rb b/lib/fog/aws/models/ec2/instance.rb index e3337b973..5c74e04ad 100644 --- a/lib/fog/aws/models/ec2/instance.rb +++ b/lib/fog/aws/models/ec2/instance.rb @@ -16,7 +16,6 @@ module Fog attribute :key_name, 'keyName' attribute :launch_time, 'launchTime' attribute :monitoring - attribute :placement attribute :product_codes, 'productCodes' attribute :private_dns_name, 'privateDnsName' attribute :ramdisk_id, 'ramdiskId' @@ -97,7 +96,7 @@ module Fog options['RamdiskId'] = @ramdisk_id end if @user_data - options['UserData'] = Base64.encode64(@user_data) + options['UserData'] = @user_data end data = connection.run_instances(@image_id, 1, 1, options) merge_attributes(data.body['instancesSet'].first) diff --git a/lib/fog/aws/requests/ec2/run_instances.rb b/lib/fog/aws/requests/ec2/run_instances.rb index c6ad95c0e..d4b792aa6 100644 --- a/lib/fog/aws/requests/ec2/run_instances.rb +++ b/lib/fog/aws/requests/ec2/run_instances.rb @@ -64,6 +64,9 @@ unless Fog.mocking? # * 'requestId'<~String> - Id of request # * 'reservationId'<~String> - Id of reservation def run_instances(image_id, min_count, max_count, options = {}) + if options['UserData'] + options['UserData'] = Base64.encode64(options['UserData']) + end request({ 'Action' => 'RunInstances', 'ImageId' => image_id,