F #3440: Fix errors on NSX auth (#3913)

This commit is contained in:
Angel Luis Moya Gonzalez authored and Tino Vázquez committed 2019-11-05 18:00:51 +01:00
1 parent 85d8d745ad
commit 35569a2460
4 files changed
+13 -8

No files matched your search

+2 -2
View File
@@ -56,10 +56,10 @@ post '/nsx/auth' do
nsxpassword,
nsx_type)
if nsx_type == 'NSX-T'
url = nsxmgr + NSXDriver::NSXConstants::NSXT_AUTH
url = NSXDriver::NSXConstants::NSXT_AUTH
response = nsx_client.get_token(url)
elsif nsx_type == 'NSX-V'
url = nsxmgr + NSXDriver::NSXConstants::NSXV_AUTH
url = NSXDriver::NSXConstants::NSXV_AUTH
response = nsx_client.get_token(url)
else
return [400,
@@ -57,7 +57,7 @@ module NSXDriver
NSXV_TZ_XPATH = '//virtualWire/vdnScopeId'
# OpaqueNetwork
NSXT_BASE = '/api/v1'
NSXT_AUTH = '/aaa/registration-token'
NSXT_AUTH = NSXT_BASE + '/aaa/registration-token'
NSXT_LS_SECTION = NSXT_BASE + '/logical-switches/'
# Messages
MSG_INCOMPLETE_REQ = 'Incomplete request, NSX_MANAGER, NSX_USER, \
@@ -119,10 +119,10 @@ module NSXDriver
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|
https.request(request)
end
response_xml = Nokogiri::XML response.body \
if check_response(response, 200)
token = response_xml.xpath('//authToken/value').text
{ 'token' => token }.to_json
return unless check_response(response, 200)
response.body
end
end
@@ -117,7 +117,12 @@ module NSXDriver
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|
https.request(request)
end
response.body if check_response(response, 200)
return unless check_response(response, 200)
response_xml = Nokogiri::XML response.body
token = response_xml.xpath('//authToken/value').text
{ 'token' => token }.to_json
end
end