Skip to content

Commit

Permalink
Fix compatibility with CloudFront API version 2010-11-01
Browse files Browse the repository at this point in the history
The latest version of right_aws uses the API version 2010-11-01 of
CloudFront, so the streaming-distribution script has to be updated for
that API version.
  • Loading branch information
jfturcot committed Aug 8, 2012
1 parent bccb205 commit 9afebcf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cf-streaming-distribution.rb
Expand Up @@ -142,7 +142,7 @@
puts " Status : #{dist[:status]}"
puts " Enabled : #{dist[:enabled].to_s}"
puts " domain_name : #{dist[:domain_name]}"
puts " origin : #{dist[:origin]}"
puts " origin : #{dist[:s3_origin][:dns_name].split(".")[0]}"
puts " CNAMEs : #{cn.join(", ")}"
puts " Comment : #{dist[:comment]}"
end
Expand Down Expand Up @@ -172,7 +172,7 @@
puts " Status : #{result[:status]}"
puts " Enabled : #{result[:enabled].to_s}"
puts " domain_name : #{result[:domain_name]}"
puts " origin : #{result[:origin]}"
puts " origin : #{result[:s3_origin][:dns_name].split(".")[0]}"
puts " CNAMEs : #{cn.join(", ")}"
puts " Comment : #{result[:comment]}"
if result[:origin_access_identity]
Expand Down Expand Up @@ -235,8 +235,13 @@
end

begin
result = cf.create_streaming_distribution(bucket, comment,
true, cnames)
config = {
:s3_origin => {:dns_name => bucket},
:comment => comment,
:enabled => true,
:cnames => Array(cnames),
}
result = cf.create_streaming_distribution(config)
rescue RightAws::AwsError => e
e.errors.each do |code, msg|
puts "Error (#{code}): #{msg}"
Expand Down Expand Up @@ -269,7 +274,7 @@
config[:trusted_signers] = signers if signers.length > 0
config[:cnames] = cnames if cnames.length > 0
config[:enabled] = enabled if enabled != nil
config[:origin_access_identity] = "origin-access-identity/cloudfront/#{oai}" if oai
config[:s3_origin][:origin_access_identity] = "origin-access-identity/cloudfront/#{oai}" if oai

result = cf.set_streaming_distribution_config(aws_id, config)

Expand Down

0 comments on commit 9afebcf

Please sign in to comment.