mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #795: Add conf variable for Cloud Auth
This commit is contained in:
parent
54f769170d
commit
9419406f6e
@ -8,11 +8,11 @@ class CloudAuth
|
||||
attr_reader :client, :token
|
||||
|
||||
def initialize(conf)
|
||||
@xmlrpc = conf[:one_xmlrpc]
|
||||
@conf = conf
|
||||
|
||||
if AUTH_MODULES.include?(conf[:auth])
|
||||
require 'CloudAuth/' + AUTH_MODULES[conf[:auth]]
|
||||
extend Kernel.const_get(AUTH_MODULES[conf[:auth]])
|
||||
if AUTH_MODULES.include?(@conf[:auth])
|
||||
require 'CloudAuth/' + AUTH_MODULES[@conf[:auth]]
|
||||
extend Kernel.const_get(AUTH_MODULES[@conf[:auth]])
|
||||
else
|
||||
raise "Auth module not specified"
|
||||
end
|
||||
@ -21,7 +21,7 @@ class CloudAuth
|
||||
protected
|
||||
|
||||
def get_password(username)
|
||||
@oneadmin_client ||= OpenNebula::Client.new(nil, @xmlrpc)
|
||||
@oneadmin_client ||= OpenNebula::Client.new(nil, @conf[:one_xmlrpc])
|
||||
|
||||
if @user_pool.nil?
|
||||
@user_pool ||= OpenNebula::UserPool.new(@oneadmin_client)
|
||||
|
@ -80,22 +80,4 @@ class CloudServer
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
def self.get_instance_types(config)
|
||||
if config[:vm_type] == nil
|
||||
raise "No VM_TYPE defined."
|
||||
end
|
||||
|
||||
instance_types = Hash.new
|
||||
|
||||
if config[:vm_type].kind_of?(Array)
|
||||
config[:vm_type].each {|type|
|
||||
instance_types[type['NAME']]=type
|
||||
}
|
||||
else
|
||||
instance_types[config[:vm_type]['NAME']]=config[:vm_type]
|
||||
end
|
||||
|
||||
instance_types
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user