Skip to content

Commit

Permalink
Fix protocol selection when adding a new nuage provider
Browse files Browse the repository at this point in the history
  • Loading branch information
gasper-vrhovsek committed Dec 4, 2017
1 parent 377e47f commit 1ba9c1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/manageiq/providers/nuage/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def raw_connect(username, password, endpoint_opts)
end

def auth_url(protocol, server, port, version)
scheme = protocol == "ssl-with-validation" ? "https" : "http"
scheme = protocol == "non-ssl" ? "http" : "https"
URI::Generic.build(:scheme => scheme, :host => server, :port => port, :path => "/nuage/api/#{version}").to_s
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/models/manageiq/providers/nuage/network_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
expect(described_class.auth_url(nil, 'hostname', 8443, 'v5')).to eq('http://hostname:8443/nuage/api/v5')
end

it 'builds insecure ssl URL' do
expect(described_class.auth_url('ssl', 'hostname', 8443, 'v5')).to eq('https://hostname:8443/nuage/api/v5')
end

it 'builds secure URL' do
expect(described_class.auth_url('ssl-with-validation', 'hostname', 8443, 'v5')).to eq('https://hostname:8443/nuage/api/v5')
end
Expand Down

0 comments on commit 1ba9c1b

Please sign in to comment.