mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Add support for setting redis port and password
This commit adds options for setting redis port and password. Without this change it is not possible to specify the redis port or password.
This commit is contained in:
parent
00970ffc9e
commit
a9ca914832
2 changed files with 6 additions and 4 deletions
|
|
@ -86,8 +86,8 @@ module Vmpooler
|
||||||
parsed_config
|
parsed_config
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_redis(host = 'localhost')
|
def self.new_redis(host = 'localhost', port = nil, password = nil)
|
||||||
Redis.new(host: host)
|
Redis.new(host: host, port: port, password: password)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_logger(logfile)
|
def self.new_logger(logfile)
|
||||||
|
|
|
||||||
6
vmpooler
6
vmpooler
|
|
@ -7,13 +7,15 @@ require 'lib/vmpooler'
|
||||||
|
|
||||||
config = Vmpooler.config
|
config = Vmpooler.config
|
||||||
redis_host = config[:redis]['server']
|
redis_host = config[:redis]['server']
|
||||||
|
redis_port = config[:redis]['port']
|
||||||
|
redis_password = config[:redis]['password']
|
||||||
logger_file = config[:config]['logfile']
|
logger_file = config[:config]['logfile']
|
||||||
|
|
||||||
metrics = Vmpooler.new_metrics(config)
|
metrics = Vmpooler.new_metrics(config)
|
||||||
|
|
||||||
api = Thread.new do
|
api = Thread.new do
|
||||||
thr = Vmpooler::API.new
|
thr = Vmpooler::API.new
|
||||||
thr.helpers.configure(config, Vmpooler.new_redis(redis_host), metrics)
|
thr.helpers.configure(config, Vmpooler.new_redis(redis_host, redis_port, redis_password), metrics)
|
||||||
thr.helpers.execute!
|
thr.helpers.execute!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -21,7 +23,7 @@ manager = Thread.new do
|
||||||
Vmpooler::PoolManager.new(
|
Vmpooler::PoolManager.new(
|
||||||
config,
|
config,
|
||||||
Vmpooler.new_logger(logger_file),
|
Vmpooler.new_logger(logger_file),
|
||||||
Vmpooler.new_redis(redis_host),
|
Vmpooler.new_redis(redis_host, redis_port, redis_password),
|
||||||
metrics
|
metrics
|
||||||
).execute!
|
).execute!
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue