1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

F #5189 new azure auth options requests

This commit is contained in:
semedi 2017-07-06 00:40:15 +02:00
parent 1a3de82cab
commit 589d7a1230
2 changed files with 12 additions and 11 deletions

View File

@ -48,8 +48,8 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
#-----------------------------------------------------------------------
# Supported AZURE AUTH ATTRIBUTTES:
#
# CERTIFICATE = <azure classic certificate>
#
# AZ_ID = <azure classic id>
# AZ_CERT = <azure classic certificate>
#
#
#

View File

@ -162,13 +162,14 @@ class AzureDriver
@region['management_endpoint']="https://management.core.windows.net"
end
conn_opts = get_connect_info(host)
file = Tempfile.new("certificate")
file << get_connect_info(host)
file << conn_opts[:cert]
file.close
Azure.configure do |config|
config.management_certificate = file.path
config.subscription_id = @region['subscription_id']
config.subscription_id = conn_opts[:id]
config.management_endpoint = @region['management_endpoint']
end
@ -178,6 +179,8 @@ class AzureDriver
@azure_vms = Azure::VirtualMachineManagementService.new
end
# Check the current template to retrieve
# conection info needed for Azure
def get_connect_info(host)
conn_opts={}
client = OpenNebula::Client.new
@ -189,18 +192,16 @@ class AzureDriver
system = OpenNebula::System.new(client)
config = system.get_configuration
if OpenNebula.is_error?(config)
puts "Error getting oned configuration : #{config.message}"
exit -1
end
raise "Error getting oned configuration : #{config.message}" if OpenNebula.is_error?(config)
token = config["ONE_KEY"]
conn_opts = {
:cert => xmlhost["TEMPLATE/CERTIFICATE"]
:cert => xmlhost["TEMPLATE/AZ_CERT"],
:id => xmlhost["TEMPLATE/AZ_ID"]
}
return xmlhost["TEMPLATE/CERTIFICATE"]#gsub(/ñ/,"\n")
return conn_opts
end
# DEPLOY action