Skip to content

Commit

Permalink
Wrapping openstack endpoint, user, password, and tenant to be properly
Browse files Browse the repository at this point in the history
escaped at the bosh registry templates

[Fixes #99745628] (https://www.pivotaltracker.com/story/show/99745628)

Signed-off-by: Shatarupa Nandi <s.nandi@pivotal.io>
  • Loading branch information
Kam Leung committed Jul 30, 2015
1 parent df83dbe commit f0fba22
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
8 changes: 4 additions & 4 deletions release/jobs/director/templates/director.yml.erb.erb
Expand Up @@ -267,8 +267,8 @@ cloud:
<% end %>
registry:
endpoint: http://<%= reg_address %>:<%= reg_port %>
user: <%= reg_user %>
password: <%= reg_password %>
user: <%= JSON.dump(reg_user) %>
password: <%= JSON.dump(reg_password) %>
<% if_p('aws.stemcell.kernel_id') do |kernel_id| %>
stemcell:
kernel_id: <%= kernel_id %>
Expand Down Expand Up @@ -328,8 +328,8 @@ cloud:
<% end %>
registry:
endpoint: http://<%= reg_address %>:<%= reg_port %>
user: <%= reg_user %>
password: <%= reg_password %>
user: <%= JSON.dump(reg_user) %>
password: <%= JSON.dump(reg_password) %>
<% end %>
<% if_p('vcenter.address', 'vcenter.user', 'vcenter.password', 'vcenter.datacenters') do |address, user, password, datacenters| %>
Expand Down
62 changes: 62 additions & 0 deletions release/spec/director.yml.erb.erb_spec.rb
Expand Up @@ -333,6 +333,37 @@
end
end

context 'when openstack.registry.user contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['http']['user'] = "!openstack.user"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['user']).to eq("!openstack.user")
end
end

context 'when openstack.registry.password contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['http']['password'] = "!openstack.password"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['password']).to eq("!openstack.password")
end
end

context 'when openstack.registry.endpoint contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['address'] = "!openstack.address"
deployment_manifest_fragment['properties']['registry']['http']['port'] = "!4578"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['endpoint']).to eq("http://!openstack.address:!4578")
end
end

context 'when openstack.api_key contains special characters' do
before do
deployment_manifest_fragment['properties']['openstack']['api_key'] = "!openstack.api_key''"
Expand Down Expand Up @@ -435,6 +466,37 @@
})
end

context 'when aws.registry.user contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['http']['user'] = "!aws.user"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['user']).to eq("!aws.user")
end
end

context 'when aws.registry.password contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['http']['password'] = "!aws.password"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['password']).to eq("!aws.password")
end
end

context 'when aws.registry.endpoint contains special characters' do
before do
deployment_manifest_fragment['properties']['registry']['address'] = "!aws.address"
deployment_manifest_fragment['properties']['registry']['http']['port'] = "!4578"
end

it 'renders correctly' do
expect(parsed_yaml['cloud']['properties']['registry']['endpoint']).to eq("http://!aws.address:!4578")
end
end

context 'and using an s3 blobstore' do
before do
deployment_manifest_fragment['properties']['blobstore'] = {
Expand Down

0 comments on commit f0fba22

Please sign in to comment.