Import nodepool.builder late for statsd

Statsd does crazy import time thing that fail if we import before we can
setup the things statsd wants to operate. We already import
nodepool.nodepool late for this reason, now do the same for
nodepool.builder.

Change-Id: Ib7ed37e065eda30013b1be74143be5432d9c619e
This commit is contained in:
Clark Boylan 2016-01-14 16:20:23 -08:00
parent 9253ae99e9
commit cdaba901d9

View File

@ -30,8 +30,6 @@ import signal
import traceback
import threading
from nodepool import builder
# No nodepool imports here because they pull in paramiko which must not be
# imported until after the daemonization.
# https://github.com/paramiko/paramiko/issues/59
@ -125,12 +123,15 @@ class NodePoolDaemon(object):
os._exit(0)
def main(self):
# Imports happen late to accomodate statsd's import time operations
# which set up statsd.
import nodepool.nodepool
self.setup_logging()
self.pool = nodepool.nodepool.NodePool(self.args.secure,
self.args.config)
if self.args.builder:
self.builder = builder.NodePoolBuilder(self.args.config)
import nodepool.builder
self.builder = nodepool.builder.NodePoolBuilder(self.args.config)
signal.signal(signal.SIGINT, self.exit_handler)
# For back compatibility: