Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix case where ssl_certificate_id changes after create fails with 'expected string value' #449

Merged
merged 2 commits into from
Aug 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/chef/provisioning/aws_driver/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)
elsif ! server_certificate_eql?(listener.server_certificate,
server_cert_from_spec(desired_listener))
# Server certificate is mutable - if no immutable changes required a full recreate, update cert
perform_action.call(" update server certificate from #{listener.server_certificate} to #{desired_listener[:server_certificate]}") do
listener.server_certificate = desired_listener[:server_certificate]
perform_action.call(" update server certificate from #{listener.server_certificate} to #{server_cert_from_spec(desired_listener)}") do
listener.server_certificate = server_cert_from_spec(desired_listener)
end
end

Expand All @@ -354,7 +354,7 @@ def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)
updates << " set protocol to #{listener[:protocol].inspect}"
updates << " set instance port to #{listener[:instance_port].inspect}"
updates << " set instance protocol to #{listener[:instance_protocol].inspect}"
updates << " set server certificate to #{listener[:server_certificate]}" if listener[:server_certificate]
updates << " set server certificate to #{server_cert_from_spec(listener)}" if server_cert_from_spec(listener)
perform_action.call(updates) do
actual_elb.listeners.create(listener)
end
Expand Down
26 changes: 26 additions & 0 deletions spec/integration/load_balancer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
private_key private_key_string
end

aws_server_certificate "load_balancer_cert_2" do
certificate_body cert_string
private_key private_key_string
end

it "creates a load_balancer with the maximum attributes" do
expect_recipe {
load_balancer 'test-load-balancer' do
Expand Down Expand Up @@ -173,6 +178,13 @@
:protocol => :http,
:instance_port => 80,
:instance_protocol => :http,
},
{
:port => 8443,
:protocol => :https,
:instance_port => 80,
:instance_protocol => :http,
:ssl_certificate_id => load_balancer_cert.aws_object.arn
}],
subnets: ["test_public_subnet"],
security_groups: ["test_security_group"],
Expand Down Expand Up @@ -219,6 +231,13 @@
:instance_port => 8080,
:instance_protocol => :http,
:ssl_certificate_id => load_balancer_cert.aws_object.arn
},
{
:port => 8443,
:protocol => :https,
:instance_port => 80,
:instance_protocol => :http,
:ssl_certificate_id => load_balancer_cert_2.aws_object.arn
}],
subnets: ["test_public_subnet2"],
security_groups: ["test_security_group2"],
Expand Down Expand Up @@ -262,6 +281,13 @@
:instance_port => 8080,
:instance_protocol => :http,
:server_certificate => {arn: load_balancer_cert.aws_object.arn}
},
{
:port => 8443,
:protocol => :https,
:instance_port => 80,
:instance_protocol => :http,
:server_certificate => {arn: load_balancer_cert_2.aws_object.arn}
}],
subnets: [test_public_subnet2.aws_object],
security_groups: [test_security_group2.aws_object],
Expand Down