DevStack support
[doctor.git] / doctor_tests / installer / __init__.py
1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import os
10
11 from oslo_config import cfg
12 from oslo_utils import importutils
13
14 OPTS = [
15     cfg.StrOpt('type',
16                default=os.environ.get('INSTALLER_TYPE', 'devstack'),
17                choices=['apex', 'daisy', 'fuel', 'devstack'],
18                help='the type of installer',
19                required=True),
20     cfg.StrOpt('ip',
21                default=os.environ.get('INSTALLER_IP', '127.0.0.1'),
22                help='the ip of installer'),
23     cfg.StrOpt('key_file',
24                default=os.environ.get('SSH_KEY', None),
25                help='the key for user to login installer server',
26                required=False),
27 ]
28
29
30 _installer_name_class_mapping = {
31     'apex': 'doctor_tests.installer.apex.ApexInstaller',
32     'daisy': 'doctor_tests.installer.daisy.DaisyInstaller',
33     'fuel': 'doctor_tests.installer.mcp.McpInstaller',
34     'devstack': 'doctor_tests.installer.devstack.DevstackInstaller'
35 }
36
37
38 def get_installer(conf, log):
39     installer_class = _installer_name_class_mapping[conf.installer.type]
40     return importutils.import_object(installer_class, conf, log)