Better organize the source file structure of the build manager and change it to choose a lifecycle manager based on the config

This commit is contained in:
Joseph Schorr 2014-11-25 16:14:44 -05:00
parent c48559ee3d
commit 660a640de6
12 changed files with 34 additions and 20 deletions

29
buildman/builder.py Normal file
View file

@ -0,0 +1,29 @@
import logging
from app import app, userfiles as user_files, build_logs, dockerfile_build_queue
from buildman.manager.enterprise import EnterpriseManager
from buildman.server import BuilderServer
LOGGER = logging.getLogger(__name__)
BUILD_MANAGERS = {
'enterprise': EnterpriseManager
}
def run_build_manager():
build_manager_config = app.config.get('BUILD_MANAGER')
if build_manager_config is None:
return
manager_klass = BUILD_MANAGERS.get(build_manager_config[0])
if manager_klass is None:
return
server = BuilderServer(app.config['SERVER_HOSTNAME'], dockerfile_build_queue, build_logs,
user_files, manager_klass)
server.run('0.0.0.0')
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
run_build_manager()