mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-22 20:54:49 +09:00
1 parent
85d8d745ad
commit
35569a2460
4 files changed
+13
-8
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user