mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 10:28:41 -05:00
(MAINT) Make Port Check Configurable
This change makes the port and port timeout configurable via the YAML config file. Before these were hard coded to 22 and 5, respectively. Tests have been added to verify the default is chosen when not configured and the configuration is picked up when supplied.
This commit is contained in:
parent
1a6cd99ed2
commit
f580f9915e
3 changed files with 50 additions and 4 deletions
|
|
@ -1,5 +1,12 @@
|
|||
module Vmpooler
|
||||
class PoolManager
|
||||
|
||||
# Defaults
|
||||
# port number to verify pending VM is ready
|
||||
DEFAULT_PORT_NO = 22
|
||||
# timeout, in seconds, when connecting to DEFAULT_PORT_NO
|
||||
DEFAULT_PORT_TIMEOUT = 5
|
||||
|
||||
def initialize(config, logger, redis, graphite=nil)
|
||||
$config = config
|
||||
|
||||
|
|
@ -32,8 +39,8 @@ module Vmpooler
|
|||
|
||||
if host
|
||||
begin
|
||||
Timeout.timeout(5) do
|
||||
TCPSocket.new vm, 22
|
||||
Timeout.timeout($config[:config]['port_timeout'] || DEFAULT_PORT_TIMEOUT) do
|
||||
TCPSocket.new vm, ($config[:config]['port'] || DEFAULT_PORT_NO)
|
||||
end
|
||||
move_pending_vm_to_ready(vm, pool, host)
|
||||
rescue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue