mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
F #5189 az_driver ask for CERTIFICATE ATT
This commit is contained in:
parent
5f35e0d0ab
commit
1a3de82cab
@ -42,6 +42,29 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
EOT
|
||||
},
|
||||
:az => {
|
||||
:help => <<-EOT.unindent,
|
||||
#-----------------------------------------------------------------------
|
||||
# Supported AZURE AUTH ATTRIBUTTES:
|
||||
#
|
||||
# CERTIFICATE = <azure classic certificate>
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
EOT
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ require 'yaml'
|
||||
require 'rubygems'
|
||||
require 'azure'
|
||||
require 'uri'
|
||||
require 'tempfile'
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
|
||||
@ -161,15 +162,47 @@ class AzureDriver
|
||||
@region['management_endpoint']="https://management.core.windows.net"
|
||||
end
|
||||
|
||||
file = Tempfile.new("certificate")
|
||||
file << get_connect_info(host)
|
||||
file.close
|
||||
|
||||
Azure.configure do |config|
|
||||
config.management_certificate = @region['pem_management_cert']
|
||||
config.management_certificate = file.path
|
||||
config.subscription_id = @region['subscription_id']
|
||||
config.management_endpoint = @region['management_endpoint']
|
||||
end
|
||||
|
||||
file.unlink # deletes the temp file
|
||||
|
||||
|
||||
@azure_vms = Azure::VirtualMachineManagementService.new
|
||||
end
|
||||
|
||||
def get_connect_info(host)
|
||||
conn_opts={}
|
||||
client = OpenNebula::Client.new
|
||||
|
||||
pool = OpenNebula::HostPool.new(OpenNebula::Client.new)
|
||||
pool.info
|
||||
objects=pool.select {|object| object.name==host }
|
||||
xmlhost = objects.first
|
||||
|
||||
system = OpenNebula::System.new(client)
|
||||
config = system.get_configuration
|
||||
if OpenNebula.is_error?(config)
|
||||
puts "Error getting oned configuration : #{config.message}"
|
||||
exit -1
|
||||
end
|
||||
token = config["ONE_KEY"]
|
||||
|
||||
conn_opts = {
|
||||
:cert => xmlhost["TEMPLATE/CERTIFICATE"]
|
||||
}
|
||||
|
||||
return xmlhost["TEMPLATE/CERTIFICATE"]#gsub(/ñ/,"\n")
|
||||
|
||||
end
|
||||
|
||||
# DEPLOY action
|
||||
def deploy(id, host, xml_text, lcm_state, deploy_id)
|
||||
if lcm_state == "BOOT" || lcm_state == "BOOT_FAILURE"
|
||||
|
Loading…
x
Reference in New Issue
Block a user