Aviator Session Pool
Experimental library for managing Aviator sessions.
require 'aviator'
require 'aviator/session_pool'
Aviator::SessionPool.configure(
config_file: 'path/to/aviator.yml',
environment: :production,
log_file: 'path/to/aviator.log',
redis_host: 'localhost',
redis_port: 6785
)
Aviator::SessionPool.get_or_create(session[:session_id]) do |creds|
creds.username = username
creds.password = password
end
unless unscoped = Aviator::SessionPool.get(session[:session_id])
end
Aviator::SessionPool.get_or_create(session[:session_id] + tenant_name.underscore) do |creds|
creds.token_id = unscoped[:auth_info][:access][:token][:id]
creds.tenant_name = tenant_name
end
Aviator::SessionPool.set_current(session[:session_id] + tenant_name.underscore)
Aviator::SessionPool.get_current.compute_service.request(:list_servers)
admin = Aviator::SessionPool.get_or_create('admin')
Aviator::SessionPool.get_or_create('admin').identity_service.request(:list_tenants, endpoint_type: :admin)