1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
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 ##############################################################################
11 from oslo_config import cfg
12 from oslo_utils import importutils
16 default=os.environ.get('INSTALLER_TYPE', 'local'),
17 choices=['local', 'apex'],
18 help='the type of installer',
21 default=os.environ.get('INSTALLER_IP', '127.0.0.1'),
22 help='the ip of installer'),
23 cfg.StrOpt('username',
25 help='the user name for login installer server',
30 _installer_name_class_mapping = {
31 'local': 'installer.local.LocalInstaller',
32 'apex': 'installer.apex.ApexInstaller'
36 def get_installer(conf, log):
37 installer_class = _installer_name_class_mapping[conf.installer.type]
38 return importutils.import_object(installer_class, conf, log)