mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
This commit adds options for setting redis port and password. Without this change it is not possible to specify the redis port or password.
38 lines
865 B
Ruby
Executable file
38 lines
865 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
|
|
require 'rubygems' unless defined?(Gem)
|
|
require 'lib/vmpooler'
|
|
|
|
config = Vmpooler.config
|
|
redis_host = config[:redis]['server']
|
|
redis_port = config[:redis]['port']
|
|
redis_password = config[:redis]['password']
|
|
logger_file = config[:config]['logfile']
|
|
|
|
metrics = Vmpooler.new_metrics(config)
|
|
|
|
api = Thread.new do
|
|
thr = Vmpooler::API.new
|
|
thr.helpers.configure(config, Vmpooler.new_redis(redis_host, redis_port, redis_password), metrics)
|
|
thr.helpers.execute!
|
|
end
|
|
|
|
manager = Thread.new do
|
|
Vmpooler::PoolManager.new(
|
|
config,
|
|
Vmpooler.new_logger(logger_file),
|
|
Vmpooler.new_redis(redis_host, redis_port, redis_password),
|
|
metrics
|
|
).execute!
|
|
end
|
|
|
|
if ENV['VMPOOLER_DEBUG']
|
|
trap('INT') do
|
|
puts 'Shutting down.'
|
|
[api, manager].each(&:exit)
|
|
end
|
|
end
|
|
|
|
[api, manager].each(&:join)
|