Skip to content

Commit

Permalink
Merge pull request ManageIQ#17 from bdunne/ensure_user_data_is_base64…
Browse files Browse the repository at this point in the history
…_encoded

Ensure user_data is Base64 encoded
  • Loading branch information
Fryguy authored Jul 15, 2016
2 parents bc25be4 + f4dae45 commit c9c312e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ def associate_floating_ip(ip_address)
instance.client.associate_address(:instance_id => instance.instance_id, :public_ip => ip_address)
end
end

def userdata_payload
return unless raw_script = super
Base64.encode64(raw_script)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require_relative "../../aws_helper"

describe ManageIQ::Providers::Amazon::CloudManager::Provision::Configuration do
it "#userdata_payload is Base64 encoded" do
template = FactoryGirl.build(:customization_template, :script => "#cloud-init")
provision = ManageIQ::Providers::Amazon::CloudManager::Provision.new
allow(provision).to receive(:customization_template).and_return(template)
allow(provision).to receive(:post_install_callback_url).and_return("")
expect(Base64.decode64(provision.userdata_payload)).to eq(template.script)
end
end

0 comments on commit c9c312e

Please sign in to comment.